大网数据广告活动
网站运营与故障问答

Apache proxypass directive does not recover quickly

· 52CE 我爱测

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 i…

问题原文

原帖链接 · 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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-10-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。