仅为匹配的 URL 保留 HTTP_HOST

仅为匹配的 URL 保留 HTTP_HOST

Apache mod_proxy 允许丢弃 HTTP_HOST 标头的原始值,我需要为一组 URL 保留该值,我该怎么做?

答案1

据文献记载,ProxyPreserveHost在“目录”上下文中有效。这意味着您可以将其放在<Location><LocationMatch>标签内:

ProxyPass http://example/
<Location "/">
    ProxyPreserveHost On
</Location>
<Location "/special/">
    ProxyPreserveHost Off
</Location>

如果你更喜欢:

<Location "/">
    ProxyPass http://example/
    ProxyPreserveHost On
</Location>
<Location "/special/">
    ProxyPass http://example/
    ProxyPreserveHost Off
</Location>

相关内容