Quantcast
Channel: Nginx Forum - Other discussion
Viewing all articles
Browse latest Browse all 972

502 bad gateway using proxy_intercept_error and error_page

$
0
0
So I'm reading the documentation on proxy_intercept_errors and error_page and for the life of me can't figure out why I'm getting a 502 bad gateway using the custom error page on intercepted proxy errors.

set in the http directive for global use.
error_page 500 502 503 504 /503maintenance.html;
error_page 401 403 /403access-denied.html;
error_page 404 /404filenotfound.html;


set in a separate server directive
location / {
proxy_pass https://some-backend-webserver;
proxy_intercept_errors on;
}

location ~* /*.html {
root /customerrorpages;
internal;
}

- So currently we are testing a receiving a 404 - page not found from the back end web server. if proxy_intercept_errors is off then we see the 404 from the backend web server get passed through.
- If proxy_intercept_errors is on the 404 appears to be process as a new request and turns into a 502 bad gateway. ( I do get the custom 502 error page)
- If I remove the coding for the custom error pages I see the nginx 404 error page.

Any ideas why this is happening ?

Viewing all articles
Browse latest Browse all 972


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>