Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache proxy caching "service temporarily unavailable" response when target is down

I have apache sitting in front of my node server. Node is running on certain port, I am using apache to proxy to that port and also have apache configured for https.

When I start apache and then start my node server everything runs great. If I bring down the node server and try to hit my service apache says 'Service Temporarily Unavailable'. This is expected as my node server is down.

However when I bring my server back up without touching apache and try to hit me service again apache still says 'Service Temporarily Unavailable'. Its like apache is not trying again. If I bounce apache all is well again.

Since I am running with forever there is a chance my server could be down for a few second if a fatal happens. I don't want to have to bounce apache if that happens.

Is there anyway to get apache to always try and not cache the fact that a Service it recently tried to hit was unavailable?

like image 221
lostintranslation Avatar asked Sep 06 '13 16:09

lostintranslation


1 Answers

You need to add retry=0 to ProxyPass directive. So it will be something like:

ProxyPass /example http://backend.example.com retry=0

Check some info here: http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass

like image 80
moka Avatar answered Oct 07 '22 18:10

moka