$upstream_status may show 502 even if upstream replied with 503

Anton Ivanov nginx-forum at nginx.us
Mon Aug 17 21:39:57 UTC 2015

My nginx.conf:
http {
  upstream test {
    server max_fails=0;
    server max_fails=0;

  server {
    listen 8080;
    location / {
       proxy_pass http://test;
    proxy_next_upstream http_503;
    proxy_intercept_errors on;

  log_format main '$upstream_status';

If my upstream servers are on and always reply with 503 I expect to find in
503, 503
Instead I find
502, 503
Is it ok that first upstream status is 502 instead of 503?

Can I somehow configure nginx to show 503?
Because in case of more complicated
proxy_next_upstream error http_503
it is more useful to see fair upstream status to distinguish between error
and http_503.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,261074,261074#msg-261074

More information about the nginx mailing list