lundi 27 août 2018

How do I redirect a specific port in the IIS server to an other port

My URL Rewrite rule only works for port 80 in IIS .

The rewrite works for : http://localhost:80 --> http://localhost:8100

The rewrite works for : http://localhost:80/redirect --> http://localhost:8100

The rewrite doesnt work for : http://localhost:8080 --> http://localhost:8100

The rewrite doesnt work for : http://localhost:8080/redirect --> http://localhost:8100

My web.config is following:

<?xml version="1.0" encoding="UTF-8"?>
 <configuration>
<system.webServer>
    <directoryBrowse enabled="true" showFlags="Date, Time, Size, Extension, LongDate" />
    <rewrite>
        <rules>
            <rule name="Redirect to port 8100" stopProcessing="true">
                <match url="(.*)" />
                <conditions logicalGrouping="MatchAny">
                    <add input="{SERVER_PORT}" pattern="^8100$" negate="true" />
                </conditions>
                <action type="Redirect" url="http://{HTTP_HOST}:8100/{R:0}" />
            </rule>
        </rules>
    </rewrite>
 </system.webServer>
</configuration>

The web.config is only working on default http port 80/443 but not for an specific port.

Which changes has to be made in the web.config for working with all ports?




Aucun commentaire:

Enregistrer un commentaire