Need to limit AWS API gateway incoming request body size to less than 800 KB

0

Hi, I am working on a requirement wherein I have to restrict the incoming requests to Lamba function behind the AWS API Gateway to be less than 800 KB. This needs to implemented preferrably at the Gateway level and need to implement it in Terraform as Infrastructure-as-Code. I am thinking that AWS WAF SizeConstraint might be the answer but looks like it will only inspect up to 4096 bytes and also not sure how to implement a filter that rejects incoming requests greater than 800 KB body size in Terraform.

Thanks in Advance

1 Answer
1
Accepted Answer

The SizeConstraint operator is the right thing to use in this case - it looks at the value for the Content-Length header. The limitation on 8192 bytes is only in place if you want WAF to inspect the contents of the request.

profile pictureAWS
EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions