2

I have trouble investigating an HTTP 502 response returned by an NGINX instance.

When this happens in the browser:

enter image description here

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.

3
  • This is weird! Did you try clearing the browser cache? or else try sending requests using the curl command. Commented Apr 14, 2022 at 9:43
  • What's your nginx config contents? What is in error.log? Is there anything in Zend framework logs? Commented Apr 14, 2022 at 10:47
  • After enabling the error log I can see entries saying: "2022/04/15 14:48:40 [info] 34#34: *2257 client (...) closed keepalive connection (104: Connection reset by peer)" Commented Apr 15, 2022 at 14:51

1 Answer 1

3

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"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.