Last active
June 14, 2019 06:06
-
-
Save jordanyaker/7534574 to your computer and use it in GitHub Desktop.
This is a web.config file for doing reverse proxy with the ARR module from IIS. The configuration file was based on instructions from here: http://blogs.iis.net/carlosag/archive/2010/04/01/setting-up-a-reverse-proxy-using-iis-url-rewrite-and-arr.aspx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<system.web> | |
<httpRuntime enableVersionHeader="false" /> | |
</system.web> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="Rewrite API" stopProcessing="true"> | |
<match url="^api\/(.*)$" /> | |
<action type="Rewrite" url="https://DESTINATION.COM/{R:1}" /> | |
</rule> | |
</rules> | |
<outboundRules> | |
<preConditions> | |
<preCondition name="IsRedirect"> | |
<add input="{RESPONSE_STATUS}" pattern="^30[1237]$" /> | |
</preCondition> | |
</preConditions> | |
<rule name="API Redirect" preCondition="IsRedirect" enabled="true"> | |
<match serverVariable="RESPONSE_Location" pattern="^(https?)://DESTINATION\.COM/(.*)" /> | |
<conditions> | |
<add input="{URL}" pattern="^api\/.*$" /> | |
<add input="{HTTP_HOST}" pattern="^api\..*$" negate="true" /> | |
</conditions> | |
<action type="Rewrite" value="{R:1}://{HTTP_HOST}/api/{R:2}" /> | |
</rule> | |
<rule name="API Cookies" stopProcessing="true"> | |
<match serverVariable="RESPONSE_SET_COOKIE" pattern=".*" negate="false" /> | |
<conditions> | |
<add input="{RESPONSE_SET_COOKIE}" pattern="^(ARRAffinity=.*;Domain=)DESTINATION\.COM.*$" /> | |
</conditions> | |
<action type="Rewrite" value="{C:1}DESTINATION.COM" /> | |
</rule> | |
</outboundRules> | |
</rewrite> | |
<caching enabled="false" enableKernelCache="false" /> | |
<httpProtocol> | |
<customHeaders> | |
<remove name="X-Powered-By" /> | |
</customHeaders> | |
</httpProtocol> | |
<security> | |
<requestFiltering> | |
<verbs> | |
<add verb="OPTIONS" allowed="false" /> | |
</verbs> | |
</requestFiltering> | |
</security> | |
</system.webServer> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment