IIS Reverse proxy rule looping, failing with multiple redirects

sayish kumar 1 Reputation point
2023-01-08T13:35:48.393+00:00

Hi Team,

We have an application which runs on our proprietary webserver, we need to provide access to the application through IIS reverse proxy. Below is the normal scenario for accessing the application.

Step : Application can be accessed through the URL as below.

https://webapplication.xedge.com.sg/

For the IDP authentication request will be redirected to IDP application which is hosted in IIS.

the for authentication client browser URL will get auto changed as below.

https://webapplicationidp.xedge.com.sg/authuser.aspx?ref=https://webapplication.xedge.com.sg:444/tem...

We need be access the application through reverse proxy, for that we have configured the rules as below in the reverse proxy server.

<rule name="Reverse Proxy to IDP" enabled="true" stopProcessing="true">
<match url="^(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="webapplicationidp-r1.xedge.com.sg" />
<conditions>
<action type="Rewrite" url="https://webapplicationidp.xedge.com.sg/{R:1}" />
<serverVariables>
<set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
<set name="HTTP_ACCEPT_ENCODING" value="" />
</serverVariables>
</rule>

<rule name="Reverse Proxy to Application" enabled="true" stopProcessing="true">
<match url="^(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="webapplication-r1.xedge.com.sg" />
<conditions>
<action type="Rewrite" url="https://webapplication.xedge.com.sg/{R:1}" />
<serverVariables>
<set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
<set name="HTTP_ACCEPT_ENCODING" value="" />
</serverVariables>
</rule>

<rule name="Reverse Proxy to Application Authentication" enabled="true" stopProcessing="true">
<match url="^(.)" />
<conditions>
<add input="{REQUEST_URI}" matchtype="Pattern" pattern="https://webapplicationidp-r1.xedge.com.sg/authuser.aspx.aspx(.
)$" negate="true" />
<conditions>
<action type="Rewrite" url="https://webapplicationidp-r1.xedge.com.sg/authuser.aspx?ref=https://webapplication-r1.xedge.com.sg/templates/idpconnect.w3p;fromUrl=http%253A%252F%252Fwebapplication-r1.xedge.com.sg%252Findex.w3p" />
<serverVariables>
<set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
<set name="HTTP_ACCEPT_ENCODING" value="" />
</serverVariables>
</rule>

<outboundRules>
<rule name="EDS" preCondition="ResponseIsHtml1" enabled="true">
<match filterByTags="A, Form, Head, Img, Link, Script" pattern="^http(s)?://webapplicationidp-r1.xedge.com.sg/(.*)" />
<action type="Rewrite" value="http{R:1}://webapplicationidp.xedge.com.sg/{R:2}" />
</rule>

<rule name="EDS" preCondition="ResponseIsHtml1" enabled="true">
<match filterByTags="A, Form, Head, Img, Link, Script" pattern="^http(s)?://webapplication-r1.xedge.com.sg/(.*)" />
<action type="Rewrite" value="http{R:1}://webapplication.xedge.com.sg/{R:2}" />
</rule>
</outboundRules>

<rule name="RestoreAcceptEncoding" preCondition="NeedsRestoringAcceptEncoding">
<match serverVariable="HTTP_ACCEPT_ENCODING" pattern="^(.*)" />
<action type="Rewrite" value="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" />
</rule>

<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>

<preCondition name="NeedsRestoringAcceptEncoding">
<add input="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" pattern=".+" />
</preCondition>

<preCondition name="ResponseIsTextAnything">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/(.+)" />
</preCondition>
</preConditions>

application keeps on redirecting when accessing, and fails with multiple redirects. and cookies which are created in the reverse proxy servers are also not getting passed to the back-end web sever. Could you please help to solve this issue ?

Please let me know if you need any more information.

regards,

sai

Windows development Internet Information Services
{count} votes

1 answer

Sort by: Most helpful
  1. sayish kumar 1 Reputation point
    2023-01-09T09:23:36.46+00:00

    Hi Yurong,

    We are trying to access https://webapplication.xedge.com.sg/ url from the client machine, browser finally shows failed with multiple redirects.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.