Quantcast
Channel: URL Rewrite Module
Viewing all articles
Browse latest Browse all 2482

Reverse Proxy fails to include path/file

$
0
0

I am helping a charity who have a website currently hosted on an IIS package and want a new site which needs to be hosted in a Linux/Apache environment. 

Because of the way email is set up on the existing host, switching hosting would be a very painful option. Both the IIS package and the Linux package are at the same web hosting company (1 & 1), their "Frame Redirect" option does not work properly and their rather prescriptive dns setup has not allowed the creation of a A record pointing at the second hosting package. 

Therefore, the solution would appear to be to use web.config rewrite rules to take traffic from myoriginalsite.co.uk to mynewsite.co.uk leaving the title in the browser bar showing the original url.

The code I have tried is as follows:-

<configuration><system.webServer><rewrite><rules><rule name="Proxy" ><match url="(.*)" /><conditions><add input="{CACHE_URL}" pattern="^(https?)://" /></conditions><action type="Rewrite" url="{C:1}://mynewsite.co.uk/{R:1}" /></rule></rules></rewrite></system.webServer></configuration>

This is actually doing the same as 1 & 1 Frame Redirect - all traffic going to myoriginalsite.co.uk is ending up on mynewsite.co.uk but without the addition of any path/file information, that is:-

myoriginalsite.co.uk/path/file.html 

Gets rewritten to:-

mynewsite.co.uk and not to mynewsite.co.uk/path/file.html

It seems that {R:1} is not coming correctly from the match condition, maybe I need something different such as 

url="^/(.*)"
 but all Reverse Proxy configurations posts I have looked at seem to use 
url="(.*)"
 so I am sure I don't quite understand how this works.

Also the https rewrite does not seem to work

What am I missing?


Viewing all articles
Browse latest Browse all 2482

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>