We’d like to be able to handle (perhaps try another server) an error
coming back after X-Accel-Redirect. In other words, the server to which
we redirected sends us a 500 – we want to handle that error, or try
another server. Is this possible?
Hello!
On Mon, Jun 01, 2009 at 04:32:05PM -0700, Brian M. wrote:
We’d like to be able to handle (perhaps try another server) an error
coming back after X-Accel-Redirect. In other words, the server to which
we redirected sends us a 500 – we want to handle that error, or try
another server. Is this possible?
There are two possible approaches for fallback to another
server(s):
-
Use upstream{} with multiple servers defined and
proxy_next_upstream configured appropriately. -
Use proxy_intercept_errors and set error_page, something like
this:location /files/ {
proxy_intercept_errors on;
error_page 500 = @fallback;
proxy_pass …;
}location @fallback {
# try another server here
proxy_pass …;
}
See wiki & docs for details.
Maxim D.