Welcome! Log In Create A New Profile

Advanced

Custom error_page

Posted by Friscia, Michael 
Friscia, Michael
Custom error_page
May 14, 2018 07:30PM
I’m not sure if I’m using error_page correctly. I’m trying to set this up so that if the upstream server returns a 500, then I show a custom error page. Is this possible? I have a custom error setup that works just fine using the instructions from this site:
https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-to-use-custom-error-pages-on-ubuntu-14-04

That all works just fine, but it seems to only work for cases when Nginx is handling it and not when the upstream server is serving an error.

Simply put, how can I have Nginx serve a custom error page when the upstream server returns a 500, 502, 503, 504 or 404?

___________________________________________
Michael Friscia
Office of Communications
Yale School of Medicine
(203) 737-7932 - office
(203) 931-5381 - mobile
http://web.yale.eduhttp://web.yale.edu/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Friscia, Michael
Re: Custom error_page
May 14, 2018 07:40PM
Ok, I kind of found the answer here
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_intercept_errors

then I realized my problem is that I only want to do this for 500,502,503 and 504, I want the upstream server to handle 404 errors on its own. So is there a way to only intercept the 5xx errors instead of all?

___________________________________________
Michael Friscia
Office of Communications
Yale School of Medicine
(203) 737-7932 - office
(203) 931-5381 - mobile
http://web.yale.eduhttp://web.yale.edu/

From: nginx <[email protected]> on behalf of Michael Friscia <[email protected]>
Reply-To: "[email protected]" <[email protected]>
Date: Monday, May 14, 2018 at 1:26 PM
To: "[email protected]" <[email protected]>
Subject: Custom error_page

I’m not sure if I’m using error_page correctly. I’m trying to set this up so that if the upstream server returns a 500, then I show a custom error page. Is this possible? I have a custom error setup that works just fine using the instructions from this site:
https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-to-use-custom-error-pages-on-ubuntu-14-04https://urldefense.proofpoint.com/v2/url?u=https-3A__www.digitalocean.com_community_tutorials_how-2Dto-2Dconfigure-2Dnginx-2Dto-2Duse-2Dcustom-2Derror-2Dpages-2Don-2Dubuntu-2D14-2D04&d=DwMGaQ&c=cjytLXgP8ixuoHflwc-poQ&r=wvXEDjvtDPcv7AlldT5UvDx32KXBEM6um_lS023SJrs&m=Ml79w-zZxEY7pcxE0hGoI2bucNS6D3eVh5pxG1pePtk&s=H4e2bACNGi7Dh_ii-YmHA6rEAb15ZstcCOgrEkmyPL0&e=

That all works just fine, but it seems to only work for cases when Nginx is handling it and not when the upstream server is serving an error.

Simply put, how can I have Nginx serve a custom error page when the upstream server returns a 500, 502, 503, 504 or 404?

___________________________________________
Michael Friscia
Office of Communications
Yale School of Medicine
(203) 737-7932 - office
(203) 931-5381 - mobile
http://web.yale.eduhttp://web.yale.edu/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login