I have the following rewrite rule on an ASP.Net site to get IIS to act as a reverse proxy:
<rewrite>
<rules>
<rule name="AppReverseProxy" enabled="true" stopProcessing="true">
<match url="([d|u|c]/.*)" />
<action type="Rewrite" url="http://127.0.0.1:12949/{R:1}" />
</rule>
</rules>
</rewrite>
So basically, anything at a path of domain.com/u/*
domain.com/d/*
or domain.com/c/*
will get forwarded to the local server. This works fine, and as a rule I've had no issues until now.
I'm having the local server return a 301 Permanent Redirect
with a Location
header set to a subdomain like: subdomain.domain.com/somePath
. This subdomain points to an entirely different server.
The problem is that IIS is rewriting the Location
header to look like domain.com/somePath
, it's removing the subdomain completely. I confirmed that its an IIS issue by accessing the site at domain.com:12949
and it redirects properly to the subdomain. How can I stop IIS from re-writing the Location
header from the local server?