Reverse Proxy on IIS for an asp.net applications

1.4k views Asked by At

I have to set up a reserve proxy in a server to redirect to multiple asp.net application on multiple server.

I follow multiple tuto on web like this one.

Finally, I created this web.config on inetpub/wwwroot directory :

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Reverse Proxy test" stopProcessing="true">
                    <match url="^test/(.*)" />
                    <action type="Rewrite" url="http://10.5.5.75/{R:1}" />
                </rule>
                <rule name="Reverse Proxy test2" stopProcessing="true">
                    <match url="^test2/(.*)" />
                    <action type="Rewrite" url="http://10.5.5.49:4242/{R:1}" />
                </rule>
            </rules>
            <outboundRules>
                <rule name="Add application prefix" preCondition="IsHTML">
                    <match filterByTags="A" pattern="^/(.*)" />
                    <conditions>
                        <add input="{URL}" pattern="^/(test|test2)/.*" />
                    </conditions>
                    <action type="Rewrite" value="/{C:1}/{R:1}" />
                </rule>
                <preConditions>
                    <preCondition name="IsHTML">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                    </preCondition>
                </preConditions>
            </outboundRules>
        </rewrite>
        <urlCompression doStaticCompression="false" doDynamicCompression="false" />
    </system.webServer>
</configuration>

But I have an unknown behaviour. When I test it with the url : 10.5.5.49/test/{mywebsite}, the url change to 10.5.5.49/{mywebsite} and so I have a Server Error. And when I add "test/" on the url, I see properly what I must see.

Can someone explain me this behaviour ? It's a IIS's configuration problem ? Or I need to add some configuration on my asp.net application ?

0

There are 0 answers