Apache httpd workers retry

500-errorapache-2.2apache-2.4mod-proxy

I have an Apache httpd web server running mod_proxy and mod_proxy_balancer. The whole of /somedir is sent to 2 worker machines which service the requests using the round robin scheduler. Each worker machine is running IIS but I don't think that is important.

I can demonstrate the load balancer working by repeatedly requesting a single page which contains the IP address of the machine and can see that it switches from one to the other in a predictable round robin fashion.

If I switch off one of the IIS servers and start requesting the same page then each page only contains the IP address of the machine that is up.
However, if I start IIS and don't run my IIS application then /somedir returns 500 (as it should).

I've added 500 to the failonstatus (Apache 2.4) so when it hits the error Apache places the worker machine into error state. Apache still returns the proxy error to the client though. How can I make Apache catch the proxy failure and retry using a different worker in the same way that a connection failure does.

Update

There is almost the same question asked in StackOverflow so joining them together.

https://stackoverflow.com/questions/11083707/httpd-mod-proxy-balancer-failover-failonstatus-transperant-switching

Best Answer

I have spoken to a Dev on httpd mailing list and he confirmed that this feature has not been implemented in the current code base. I have also reviewed the code myself. The state machine inside mod_proxy_balancer cannot retry on HTTP error but can only do so in case of connection error. I tried to implement it myself but its too complicated and I can easily make the code base unstable.

So this problem has no known solution today...

Related Topic