Thursday, April 7, 2011

RewriteRule, Proxy directive [P] - Is it possible to make request use actual proxy host?

Hello Everybody

Does anyone know whether it is possible to make rewrite rules which use the proxying [P] directive, as shown below, to behave like ProxyPass used in conjunction with ProxyPreserveHost Off.

In other words I want the server on mydomain.net to see a request for mydomain.net not mydomain.com.

RewriteCond  %{HTTP_HOST} ^mydomain.com$  [NC]
RewriteRule ^/(.*)$  http://mydomain.net/app1/$1 [P,L]


Thanks and best regards,

From stackoverflow
  • Since [P] actually uses mod_proxy, I'd try setting ProxyPreserveHost off and seeing if that does it.

    leftbrainlogic : Hi! I'm using this inside a .htaccess file (shared hosting account) so I can't use server level configuaration options. Thanks
    chaos : Ah. Then no, you can't do it.

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.