We have been running into an issue when our cookies reach a certain size (over 7k) where nginx is returning 400 Bad Request with an empty response when proxying to our tomcat. This doesn't happen when nginx is serving the static content however. We have already tried updating the nginx config to increase the buffer size so it should handle individual headers up to 16k (we've also tried to set it on server level):
http {
# ...
client_body_buffer_size 32k;
client_header_buffer_size 16k;
large_client_header_buffers 4 16k;
# ...
}
We have also upped the tomcat max-http-header-size to 16k. If we increase the cookie size to over 16k we still get a 400 bad request but the response has the "Request Header Or Cookie Too Large" error message. Something strange is happening between 8k and 16k header sizes that we can't figure out.
This does not appear to be an nginx issue, as it's unlikely for it to be returning empty pages, which are usually the classic tomcat signature.
It would appear that setting up the header size may depend on the connector that you're using:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With