400 bad nginx proxy request for tomcat but no static content

We had a problem when our cookies reach a certain size (more than 7 thousand), where nginx returns 400 Bad Request with an empty response when proxing to our tomcat. This does not happen when nginx serves static content. We have already tried to update the nginx configuration in order to increase the buffer size so that it processes individual headers to 16k (we also tried to set it at the server level):

http { # ... client_body_buffer_size 32k; client_header_buffer_size 16k; large_client_header_buffers 4 16k; # ... } 

We also increased the file size of tomcat max-http-header to 16k. If we increase the size of the cookie to more than 16k, we still receive 400 requests, but the response has the error message โ€œRequest Header or Cookie Too Largeโ€. Something strange happens between the sizes of the 8k and 16k headers, which we cannot understand.

+5
source share
1 answer

This is not a problem with nginx, as it is unlikely to return blank pages, which are usually the classic tomcat signature.

It looks like the header size setting may depend on the connector you use:

+1
source

Source: https://habr.com/ru/post/1263603/


All Articles