2

I am using this "simple" apache ProxyPass directive.

<VirtualHost *:80>
    ProxyPreserveHost On    
    ProxyPass / http://0.0.0.0:3000/
    ProxyPassReverse / http://0.0.0.0:3000/
    ServerName my.name.org
</VirtualHost>

This works well. If the internal server listening on port 3000 "goes down" temporarily, and I make a request to "my.name.org", a 503 is returned as expected. However, even if the internal server comes up, subsequent request to "my.name.org" result in a 503 for "some period of time" (whereas, if no initial request that generates a 503 occurs, no subsequent requests work as normal). Is there some value I can adjust to make it so that after bringing the internal server back up, apache will notice it and use it more quickly?

  • Have you checked the network traffic to ensure there is no local caching? – MrWhite Oct 20 '16 at 22:43
  • It's a pretty clean/fresh box so I don't think it's using any kind of other internal caching, but who knows, right? – rogerdpack Oct 21 '16 at 0:10
3

When a connection to a back-end server generates and error (default is any 5xx code) Apache marks that connection as in an Error State. Apache will then not use that connection for a period of time controlled by the retry parameter to ProxyPass. This defaults to 60 seconds.

This means that unless you change it, once your back-end generates a 5xx return code, Apache will not send any more request to it for 60 seconds, but will immediately return a 503 to the client browser.

You can change this by setting the retry to a lower number. For example, to wait only 5 seconds before re-trying:

ProxyPass / http://0.0.0.0:3000/ retry=5

Details of this options, and many others, are in the ProxyPass documentation here: https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass

  • Thanks that did it! Even searching that exact page for "retry" previously I didn't detect that setting as its as a "BalancerMember" parameter and it is to configure "Connection pool workers" all of which confused the heck out of me. Thanks! – rogerdpack Oct 21 '16 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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