Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

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

share|improve this question
1  
Verify that the HTTP response code on the error page is truly 500 - some configurations will kick back an error page that says "500 error!" but with an HTTP 200 OK response code. –  Shane Madden Aug 4 '12 at 20:16
    
I'm running the command in telnet and I definitely get "HTTP/1.1 500 Internal Server Error" in the HTTP response header. –  David Newcomb Aug 6 '12 at 13:11
add comment

1 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...

share|improve this answer
1  
I found your questions in the httpd dev list! which is why I was asking here. I looked at the code myself and it shows that by the time you get to the 500 error you are out of the retry mechanism. httpd-dev said they would try to implement it when they have time, but there's no plan to. –  David Newcomb Aug 14 '12 at 10:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.