I have URL Rewrite setup on an IIS 7.5 site: http://site1.com/
This acts as a reverse proxy to the second site: http://site2.com/
Here is the flow of events:
1. Browser does a GET on http://site1.com/somepath
2. This gets passed through to site2 because site1 is the URL Rewrite reverse proxy. This works well and the host is correctly set because I've done the mod that requires this.
3. site2 responds with a 301 status and sets the HTTP Location header to http://site3.com/somenewpath
4. site1 responds to the browser with a 301 but replaces the host in the Location header with site1: http://site1.com/somenewpath
What I want to happen in step 4 is that site1 responds with http://site3.com/somenewpath in the HTTP Location header and does a straight pass through of this data. I feel that there must be an Outbound rule that can be applied to solve this but haven't been able to figure it out yet.
Could Application Request Routing be involved? Look at IIS -> Machine or Site -> Application Request Routing Cache -> Server Proxy Settings and uncheck the "Reverse rewrite host in response headers" checkbox. If you do this at the machine level, it'll take effect for all sites. If you do it on a particular site, it'll only take effect for that site, and other sites on the box will be unaffected.