Can I turn off an Apache Directive then turn it on in an include?

Posted by javafueled on Stack Overflow See other posts from Stack Overflow or by javafueled
Published on 2010-03-11T19:06:57Z Indexed on 2010/03/11 19:09 UTC
Read the original article Hit count: 298

I have a VirtualHost block that includes common configuration items, one directive is ProxyPreserveHost.

Can I "procedurally" turn off ProxyPreserveHost for a Rewrite directive then have the include turn it back on? For example:

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

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

</VirtualHost>

The otherhost is on a CDN and preserving the host is creating some name resolution issue that is not allowing the proxying of content in the host namespace.

ProxyReserveHost is only allowed in a Server Config or VirtualHost. It doesn't look like I can selectively turn it off for the ProxyPass and ProxyPassReverse directives (encapsulated in the proxy flag of mod_rewrite).

© Stack Overflow or respective owner

Related posts about apache

Related posts about apache-config