Skip to content

Instantly share code, notes, and snippets.

@r4hulp

r4hulp/web.config.xml

Last active Aug 29, 2015
Embed
What would you like to do?
Web Config for Reverse Proxy in IIS
<rewrite>
<rules>
<rule name="Route Requests from localhost api to Remote API url" stopProcessing="true">
<match url="^api/(.*)" />
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<action type="Rewrite" url="https://www.wrapcode.com:1234/api/{R:1}" logRewrittenUrl="true" />
<serverVariables>
<set name="HTTP_ACCEPT_ENCODING" value="" />
</serverVariables>
</rule>
</rules>
<outboundRules>
<rule name="Convert remote API response to localhost API" preCondition="ResponseIsHtmlOrJSON">
<match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://www.wrapcode.com:1234/api/(.*)" />
<action type="Rewrite" value="api/{R:2}" />
</rule>
<preConditions>
<preCondition name="ResponseIsJSON">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^application/json" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.