Actually I think that solves my problem and I had not realized that. I just need to remove my error_page declaration from the global file and specify within each server block instead which is probably better anyway.
Thank you! ___________________________________________ Michael Friscia Office of Communications Yale School of Medicine (203) 737-7932 - office (203) 931-5381 - mobile http://web.yale.edu <http://web.yale.edu/> On 5/15/18, 10:28 AM, "nginx on behalf of Maxim Dounin" <[email protected] on behalf of [email protected]> wrote: Hello! On Tue, May 15, 2018 at 12:12:10PM +0000, Friscia, Michael wrote: > I’m wondering if there’s a simple way to solve this problem. > > The upstream application sometimes returns a blank 500 error > which Nginx then serves as the blank page. This is working as > intended. But what I’d like Nginx to do is display a custom > error page if the upstream 500 error is blank, but if the > upstream 500 page is not blank, then I want to serve the > upstream 500 error page. > > Has anyone ever come up with a way to handle a case like that? > > I was thinking of having a custom header in the upstream app and > if that header doesn’t exist, then serve a page from Nginx but > before I run down that path I thought I’d ask. I cannot use > proxy_intercept_errors on; because the upstream app serves > customized 404 errors that I would lose. Note that you can configure interception of only 500 error page, as nginx will only intercept errors you have an explicit error_page for. That is, a configuration like this will only intercept 500, but not 404: location / { proxy_pass https://urldefense.proofpoint.com/v2/url?u=http-3A__backend&d=DwIGaQ&c=cjytLXgP8ixuoHflwc-poQ&r=wvXEDjvtDPcv7AlldT5UvDx32KXBEM6um_lS023SJrs&m=pfIFbE09KkqBNglA9W4RlzUoYqKDM29rfBSHOg5XOik&s=4WzkIBmsh7_BBUxJIfTui_6hhHKCIVcsW2QWAb14d7w&e=; proxy_intercept_errors on; error_page 500 /error500.httml; } location = /error500.html { ... } This won't allow to test if the returned upstream error response is blank or not, but may be enough for your use case based on the above description. -- Maxim Dounin https://urldefense.proofpoint.com/v2/url?u=http-3A__mdounin.ru_&d=DwIGaQ&c=cjytLXgP8ixuoHflwc-poQ&r=wvXEDjvtDPcv7AlldT5UvDx32KXBEM6um_lS023SJrs&m=pfIFbE09KkqBNglA9W4RlzUoYqKDM29rfBSHOg5XOik&s=pF9q_2kt5MD_J8_OUzGeAckgBQ1reDUDNkn5oiPESK4&e= _______________________________________________ nginx mailing list [email protected] https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.nginx.org_mailman_listinfo_nginx&d=DwIGaQ&c=cjytLXgP8ixuoHflwc-poQ&r=wvXEDjvtDPcv7AlldT5UvDx32KXBEM6um_lS023SJrs&m=pfIFbE09KkqBNglA9W4RlzUoYqKDM29rfBSHOg5XOik&s=AmRF6lx3RCA9tqEtHlPy6LFMJ6_ITjmgF-eVj-BlzdI&e= _______________________________________________ nginx mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx
