【问题标题】:Can I turn off an Apache Directive then turn it on in an include?我可以关闭 Apache 指令然后在包含中打开它吗?
【发布时间】:2011-01-26 12:56:05
【问题描述】:

我有一个包含常用配置项的 VirtualHost 块,其中一个指令是 ProxyPreserveHost。

我可以“程序地”关闭 Rewrite 指令的 ProxyPreserveHost,然后让 include 重新打开它吗?例如:

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

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

</VirtualHost>

另一个主机位于 CDN 上,并且保留主机会产生一些名称解析问题,不允许代理主机命名空间中的内容。

ProxyReserveHost 仅允许在服务器配置或虚拟主机中使用。看起来我不能为 ProxyPass 和 ProxyPassReverse 指令选择性地关闭它(封装在 mod_rewrite 的代理标志中)。

【问题讨论】:

    标签: apache reverse-proxy apache-config


    【解决方案1】:

    在互联网上找到的以下内容解决了我的困境。顺便说一句,有一个开放的功能请求让 ProxyPreserveHost 在 Apache HTTPD 项目中的位置和目录级别可配置。

    RequestHeader 设置主机 ${build.replace.external.host} 代理> RewriteRule ^/proxypath/ http://${build.replace.external.host}/path/to/resource.html [P] ProxyPassReverse /proxypath/ http://${build.replace.external.host}/path/to/resource.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-24
      • 1970-01-01
      • 2010-12-26
      • 1970-01-01
      • 1970-01-01
      • 2015-12-02
      • 2016-07-26
      相关资源
      最近更新 更多