How to configure mod_proxy not specifically not cache 503 errors

apache-2.2mod-proxy

This is my mod_proxy config:

<IfModule mod_proxy.c>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass /manage/ http://localhost:9000/manage/
ProxyPassReverse /manage/ http://localhost:9000/manage/
</IfModule>

I find that whenever the other website I have on port 9000 doesn't respond correctly, I get sustained 503 errors – that persist even after the website is fixed. In other words, the 503 response seems to be cached.

How can I disable it? I don't think I have enabled caching myself, perhaps this is the default.

Best Answer

mod_proxy marks an unresponsive backend as down when it seems to be down; if no backends are available then it responds with a 503.

By default, a down backend will be marked as such for 60 seconds; until that time passes, it won't retry the connection (and replies with an error message to any connecting clients).

To have it retry immediately, add retry=0 to your ProxyPass directive:

ProxyPass /manage/ http://localhost:9000/manage/ retry=0