Welcome! Log In Create A New Profile

Advanced

Re: Custom error_page

May 14, 2018 01:34PM
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 <nginx-bounces@nginx.org> on behalf of Michael Friscia <michael.friscia@yale.edu>
Reply-To: "nginx@nginx.org" <nginx@nginx.org>
Date: Monday, May 14, 2018 at 1:26 PM
To: "nginx@nginx.org" <nginx@nginx.org>
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
Subject Author Posted

Custom error_page

wickedhangover May 14, 2018 01:28PM

Re: Custom error_page

wickedhangover May 14, 2018 01:34PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 232
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready