3

I am using mod_rewrite to proxy a sub-directory like this:

RewriteRule  ^somedir/(.*)$  http://proxy.example/somedir/$1  [P,L]

That means that requests to http://local.example/somedir are proxied to http://proxy.example/somedir

I am being told by the people at remote location (e.g. proxy.example) that the host headers being read by their systems see "proxy.example" as the host, but that they require us to maintain "local.example" as the host header.

How can this be done? I am hoping to keep it all in .htaccess and not have to move to ProxyPass.

Hyppy
  • 15,458
  • 1
  • 37
  • 59
Louis W
  • 271
  • 4
  • 10
  • 2
    Possible duplicate of [Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About Mod\_Rewrite Rules but Were Afraid to Ask](https://serverfault.com/questions/214512/redirect-change-urls-or-redirect-http-to-https-in-apache-everything-you-ever) – Jenny D Jun 06 '18 at 11:40

1 Answers1

0

ProxyPreserveHost may work for you in this situation. See http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypreservehost

Craig Miskell
  • 4,086
  • 1
  • 15
  • 16