[clug] force Apache to close connection on error

matt andrews wantok at gmail.com
Mon Sep 21 05:42:10 UTC 2015


On 21 September 2015 at 14:53, Bob Edwards <Robert.Edwards at anu.edu.au> wrote:
> Hi all,
>
> I am running a site with Nginx in front of Apache (actually in front
> of lots of things, but am interested in Apache at the moment).
>
> The FOSS version of Nginx can do rudimentary fail-over if an "upstream"
> (back-end) server is not responding.
>
> The commercial version of Nginx (Nginx Plus) can do fancier tricks like
> detecting if the upstream server is responding with error code 500.
>
> Alas, if my site is "half-dead", Apache responds with error code 500
> and my FOSS version of Nginx determines that as a valid response and so
> keeps on sending requests to it.
>
> What I would like to do is get Apache to close the connection instead
> of responding with error code 500. This probably breaks all kinds of
> HTTP standards, but should suffice to trigger my Nginx to fail-over
> to the backup server.
>
> Any ideas?
>
> cheers,
>
> Bob Edwards.

Hi Bob

nginx (non-Plus) should be perfectly capable of handling this via
proxy_next_upstream rules with "http_500" or similar:

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream

Cheers,

Matt.



More information about the linux mailing list