Remapping Nginx 502/504 error from proxy_pass into 408 error
syntax:
error_page
code ... [=[response]] uri;
You forgot to specify the uri
parameter (your =408
argument has been interpreted as a uri).
upd:
location / { error_page 502 504 =408 @empty;}location @empty { return 200 '';}
Getting inspiration from Is it possible to change the HTTP status code returned when proxy_pass gateway is down in nginx?, this set of directives appears to work:
location = / { return 200;}location ~ ^[a-z/0-9@A-Z]*$ { error_page 502 504 =408 /; (proxy configuration goes here)}
Other values for uri did not however.