问题原文
原帖链接 · rogerdpack · CC BY-SA 3.0
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?
已采纳解答
原帖链接 · Unbeliever · CC BY-SA 3.0
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
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
