2

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.

4
  • Do you need it for what?
    – Alexey Ten
    Apr 14, 2016 at 11:16
  • client->nginx proxy->websites. client needs to distinguish the two kinds 502 for next process. client is a crawler and has no access permission to Internet so can only use the nginx proxy to crawl website url. Apr 14, 2016 at 11:45
  • You could make nginx to return some other code. See error_page directive
    – Alexey Ten
    Apr 14, 2016 at 11:51
  • thanks. I will try. Could you give me more hints or the answer directly? Apr 18, 2016 at 5:09

0

You must log in to answer this question.

Browse other questions tagged .