Re: Override error code returned by proxy_pass

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!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs