Override error code returned by proxy_pass

Rt Ibmer rtibmx at yahoo.com
Wed May 21 07:52:20 MSD 2008

>> In the event that one of the upstream servers returns a 404 with an error page, I would like to detect that situation and throw it out, and return my own 404 error as directed by the nginx error_page directive.  Is this possible? And if so, how? Thanks!


Thanks. However it seems proxy_intercept_errors is not supported within an "if" block, even though the error_page directive is.  

I am trying to do this on a global basis so it applies to all my location blocks.  Is such a thing possible?

        if ($request ~* \.(xml)$ ) {
             error_page  404         /404.xml;
             proxy_intercept_errors  on;

        location / {
                proxy_pass              http://my_backends;

Thank you!


More information about the nginx mailing list