Welcome! Log In Create A New Profile


502 bad gateway using proxy_intercept_error and error_page

Posted by cisaksen 
502 bad gateway using proxy_intercept_error and error_page
November 29, 2018 04:57PM
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;

- 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 ?

Edited 1 time(s). Last edit at 11/29/2018 04:59PM by cisaksen.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 49
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready