Computers and Internet · Uncategorized

Web.config Reverse proxy setup for IIS with URL Rewrite

<?xml version=”1.0″ encoding=”UTF-8″?>
<rule name=”ReverseProxyInboundRule1″ stopProcessing=”true”>
<match url=”(.*)” />
<action type=”Rewrite” url=”https://<>/{R:1}” />
<set name=”HTTP_ACCEPT_ENCODING” value=”” />
<clear />
<rule name=”RestoreAcceptEncoding” preCondition=”NeedsRestoringAcceptEncoding”>
<match serverVariable=”HTTP_ACCEPT_ENCODING” pattern=”^(.*)” />
<conditions logicalGrouping=”MatchAll” trackAllCaptures=”true” />
<action type=”Rewrite” value=”{HTTP_X_ORIGINAL_ACCEPT_ENCODING}” />
<rule name=”ReverseProxyOutboundRule1″ preCondition=”ResponseIsHtml1″>
<match filterByTags=”A, Form, Img” pattern=”^http(s)?://https://<>/(.*)” />
<conditions logicalGrouping=”MatchAll” trackAllCaptures=”true” />
<action type=”Rewrite” value=”https{R:1}://<>/{R:2}” />
<preCondition name=”ResponseIsHtml1″>
<add input=”{RESPONSE_CONTENT_TYPE}” pattern=”^text/html” />
<preCondition name=”NeedsRestoringAcceptEncoding”>
<add input=”{HTTP_X_ORIGINAL_ACCEPT_ENCODING}” pattern=”.+” />

One thought on “Web.config Reverse proxy setup for IIS with URL Rewrite

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s