I’m using nginx
server (as a reverse proxy). In some rare cases, while issuing hundreds of HTTP GET
request to the server, the client receives 502
response while containing only the date
header.
I’m using default nginx
settings so configuration is not the issue.
I wonder, where is the 502
response is coming from? The nginx
? The server? Or, maybe, it is a some kind of a default browser’s behaviour?
Update:
While receiving the 502
error I can’t find any logged information about the error. I’ve checked both of the files, the api_access.log
and the api_error.log
2
Answers
Looks like HTTP/2, which only includes a header (request or response) if it’s delta indicates a change from the prior request.
In other words, in HTTP/2, if the header is the same as the previous request it’s not included again.
Obviously the
Date
header changes quite frequently, but most other headers do not.If you are using proxy_pass, and talking to HTTP/1.x behind nginx, you’ll need to configure your proxy_pass properly for your situation (Lots of answers on https://serverfault.com/questions/tagged/nginx with details on what you would need to do)
A 502 error is the NGINX proxy saying it received an incorrect response from the server.
You might want to do a manual ‘get’ with the same data as the call with the 502 error in Postman, to see if you can emulate the error.
If you cannot emulate it, the problem is most likely that the server cannot keep up with your requests, you can check if there are some optimisations you can do (client or server side), hundreds of request in general is not ideal (this could be a single request?).