We use nginx as a http proxy server.The following configuration:
location / {
proxy_pass_header Server;
proxy_pass $scheme://$http_host$request_uri;
}
When urls proxied return error code 502 from real http host, our clients receive error code 502 from nginx. When error happened such as dns error or connect error, our clients receive error code 502 too. How to distinguish between internal error code 502 and upstream returned http_502 on our nginx proxy.