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

Rau*_*ene 12 apache apache2 mod-proxy apache2.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参数吗?提前致谢.

Rau*_*ene 27

我已经设法找到了自己的解决方案.您可以直接使用以下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)

  • 这些行在哪里添加? (4认同)