I use k8s nginx ingress controller before my backend, having two instances. When web-cleint sends quite big request to ingress – nginx for POST/PUT/GET request always returns 400 Bad request. Btw, no another explanation or details for this error, or at least it is logged in some place where I cannot find it or identify that my problem is.
After googling I figured out the recipe to fix this: apply large_client_header_buffers
with increased value: that’s exactly what I did – now my buffer size is 4 256k
. But no effect , I still get this error.
Pls give me any idea how to procede this problem
2
Answers
So answer is: nginx is not guilty in described behaviour. After thoroughly investigation of log of java-app which stands behind nginx this exception was noticed
And because of this detail -
Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.
- it was too fleeting to be catch up during fluent observation of log.Summing up solution was to increase SpringBoot property
server.max-http-header-size
to to more proper value. Default value was 8 Kb.Some additonal infromation about the problem.
The large_client_header_buffers was changed for http context over ConfigMap, server context was also changed but by simply changing the nginx.conf and reloading nginx – that didn’t help either.
The problem is that the buffer chain writer buf which can be seen in the debug mode log below reaches 8k and 400 is thrown