为 Apache Server mod_proxy 指令中的所有 ProxyPass 映射设置超时

Rau*_*ene 4 mod-proxy apache-2.2

我所拥有的和工作的:

我使用Apache HTTPD 2.2来处理代理请求。我有多个ProxyPass映射:

ProxyRequests On 
<Proxy *>
AddDefaultCharset off
    Order deny,allow
    Allow from all
</Proxy>
ProxyPreserveHost Off

ProxyPass /a http://some_ip/
ProxyPassReverse /a http://some_ip/

ProxyPass /b http://some_other_ip/
ProxyPassReverse /b http://some_other_ip/

...
Run Code Online (Sandbox Code Playgroud)

这效果很好。

我想要的是:

我的一些请求花费了更长的时间,因此它们超时,给我一个代理错误 - 原因:从远程服务器读取错误

我想满足timeout我所有的要求。我可以做到这一点而不必timeout=... KeepAlive=On为每个ProxyPass映射添加吗?

我目前有类似的东西:

ProxyPass /a http://some_ip/ timeout=1200 KeepAlive=On
ProxyPassReverse /a http://some_ip/

ProxyPass /b http://some_other_ip/ timeout=1200 KeepAlive=On
ProxyPassReverse /b http://some_other_ip/

... and i do this for all my ProxyPass mappings
Run Code Online (Sandbox Code Playgroud)

我可以以某种方式告诉 Apache为所有映射添加参数吗timeoutKeepAlive提前致谢。


编辑:我也尝试直接使用mod_reqtimeout指令,但它并没有为我解决问题:

LoadModule reqtimeout_module modules/mod_reqtimeout.so

RequestReadTimeout header=1200 body=1200
Run Code Online (Sandbox Code Playgroud)

Rau*_*ene 6

我已经设法自己找到解决方案。ProxyTimeout您可以直接使用以下指令设置超时mod_proxy

ProxyRequests On 
<Proxy *>
    AddDefaultCharset off
    Order deny,allow
    Allow from all
</Proxy>
ProxyPreserveHost Off

ProxyTimeout 1200
Run Code Online (Sandbox Code Playgroud)