1

I have a web site under IIS 10.0 v1809. A specific link https://domain.name/report/ should be proxied to the local service http://localhost:7577/dashboard/. So I need to change the word dashboard to report in the server answer. To do this I set up ReverseProxy rule:

<rule name="MyReverseProxy" enabled="true" stopProcessing="true">
    <match url="report(/)?(.*)" />
    <action type="Rewrite" url="http://localhost:7577/dashboard/{R:2}" appendQueryString="true" />
</rule>

And the OutBound rule:

<outboundRules>
    <rule name="MyReverseProxy" enabled="true" stopProcessing="false">
        <match filterByTags="None" pattern="dashboard(/)?(.*)" />
        <action type="Rewrite" value="report/{R:2}" />
    </rule>
    <preConditions>
        <preCondition name="ResponseIsHtml1">
            <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
        </preCondition>
    </preConditions>
</outboundRules>

but for some reason, the outbound rule does not work for me. I get a 404 error and https://domain.name/dashboard/ appears in the browser's address bar.

What am I doing wrong? My pattern test works correctly, but why does the browser switch to dashboard?

IIS Reverse Proxy Rule

IIS OutBound Rwrite Rule

JMLabs
  • 61
  • 2
  • Outbound rules inspect the traffic sent out, look for URLs within it, and rewrite them as needed, It is mainly used to modify the content of the page. What is the purpose of your outbound rule setting? What do you want to rewrite with it? – samwu Nov 08 '21 at 08:24
  • My backend service responds with links like this http://localhost:7577/dashboard /. I need to sustitute the word `dashboard` with the word `report` and to have links in the browser like this https://domain.name/report / – JMLabs Nov 09 '21 at 11:42
  • Then you only need the ReverseProxy rule, you don’t need to set the Outbound rule. [https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing](https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing) – samwu Nov 10 '21 at 09:46

0 Answers0