2010-03-11 52 views
0

我有一個包含公共配置項的VirtualHost塊,其中一個指令是ProxyPreserveHost。我可以關閉Apache指令,然後在include中打開它嗎?

我可以「程序化」關閉ProxyReserveHost以獲得Rewrite指令,然後讓包含程序重新啓用它嗎?例如:

<VirtualHost *:80> 
ServerName www.blah.com 
... 
... 
ProxyPreserveHost off 
RewriteRule /somepath http://otherhost/otherpath [P] 

Include /path/to/file/turning-on-ProxyPreserveHost 

</VirtualHost> 

的OTHERHOST是在CDN和保存宿主是創造一些未允許在主機名稱空間的內容代理名稱解析問題。

ProxyReserveHost只能在Server Config或VirtualHost中使用。它看起來並不像我可以選擇性關閉ProxyPass和ProxyPassReverse指令(封裝在mod_rewrite的代理標誌中)。

回答

0

以下是在互聯網上找到的,解決了我的困境。順便說一下,在Apache HTTPD項目中的位置和目錄級別有一個開放功能請求,可以配置ProxyPreserveHost

 
<IfModule mod_headers.c> 
    <Proxy "http://${build.replace.host}/"> 
    RequestHeader set Host ${build.replace.external.host} 
    </Proxy> 
    RewriteRule  ^/proxypath/ http://${build.replace.external.host}/path/to/resource.html [P] 
    ProxyPassReverse /proxypath/ http://${build.replace.external.host}/path/to/resource.html 
</IfModule> 
相關問題