nginx 400 bad request
Maxim Dounin
mdounin at mdounin.ru
Wed Dec 14 23:50:42 UTC 2022
Hello!
On Wed, Dec 14, 2022 at 03:32:00PM +0530, Vishwas Bm wrote:
> Thanks for the response.
> What happens when content-length provided in request is greater than the
> post body size?
> How does nginx handle this case ?
> Does it fail with 400 ?
>
> Also how is the truncation/padding done in case of lesser or higher content
> length ?
In HTTP/1.x, Content-Length specifies the exact size of the
request body. Anything after it sent on the same persistent
connection is expected to be the next request, and it is
interpreted as an HTTP request. As long as it is not a valid HTTP
request, like in the case you are seeing in your logs, the 400
(Bad request) error is generated by nginx.
For further information about the HTTP protocol consider reading
relevant RFCs, notably RFC 9112
(https://www.rfc-editor.org/rfc/rfc9112).
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx
mailing list