I have trouble investigating an HTTP 502 response returned by an NGINX instance.
When this happens in the browser:
This is what I see in the logs:
10.244.1.82 - - [14/Apr/2022:09:21:26 0000] "GET /add HTTP/1.1" 200 3811
"https://myapplication.com/bar" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.79 Safari/537.36"
Where else to look for the reason of HTTP 502 NGINX response?
I am using NGINX as a reverse proxy. It forwards traffic to a PHP Zend application. Before I got here, I was getting HTTP 502 and the logs were mentioning upstream sent too big header while reading response header from upstream, so I increased buffer sizes. Now the logs are saying HTTP 200, but the result in the browser hasn't changed.
CodePudding user response:
Turned out I forgot I have another NGINX between the client and the NGINX instance that I was checking the logs of.
I am using Kubernetes Ingress NGINX Controller. I needed to add the following two annotations to my Ingress configuration (documentation):
nginx.ingress.kubernetes.io/proxy-buffers-number: "8"
nginx.ingress.kubernetes.io/proxy-buffer-size: "16k"