Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- applicationHost.xdt to specify that host header should be preserved and allow specific server variables (otherwise you get an exception). File is placed n the directory above wwwroot.
- <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
- <system.webServer>
- <proxy xdt:Transform="InsertIfMissing" enabled="true" preserveHostHeader="true" reverseRewriteHostInResponseHeaders="false"/>
- <rewrite xdt:Transform="InsertIfMissing">
- <allowedServerVariables xdt:Transform="InsertIfMissing">
- <add name="HTTP_X_ORIGINAL_HOST" xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)"/>
- <add name="HTTP_X_UNPROXIED_URL" xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)"/>
- <add name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)"/>
- <add name="HTTP_ACCEPT_ENCODING" xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)"/>
- <add name="HTTP_HOST" xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" />
- </allowedServerVariables>
- </rewrite>
- </system.webServer>
- </configuration>
- web.config to specify how requests should be routed:
- <system.webServer>
- <rewrite>
- <rules>
- <rule name="Blog Proxy" stopProcessing="false">
- <match url="^blog(?:$|/)(.*)" />
- <action type="Rewrite" url="https://blog.mywebsite.com/{R:1}" appendQueryString="true" logRewrittenUrl="false" />
- <serverVariables>
- <set name="HTTP_X_UNPROXIED_URL" value="https://blog.mywebsite.com/{R:1}" />
- <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
- <set name="HTTP_X_ORIGINAL_HOST" value="{HTTP_HOST}" />
- <set name="HTTP_ACCEPT_ENCODING" value="" />
- </serverVariables>
- </rule>
- </rules>
- </rewrite>
- </system.webServer>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement