skip to Main Content

I have Windows hosting with Host Gator. When I enable SSL via their Plesk platform, I assume it writes a bunch of rules including: redirecting all HTTP to HTTPS

I have some legacy ASMX web services which still need to be accessed on HTTP, so I want any attempt to access those via HTTP to remain on HTTP, until I have the chance to roll out new changes (My web services have their own Web.config files in sub-dirs from the main website)

I have added the following into the Web.config for the ASMX service, but i’m experiencing problems. It gets caught in an endless redirect loop!

        <rule name="MakeAMSXHTTPOnly" stopProcessing="true">
            <match url="(.*)" />
              <conditions>
                <add input="{R:1}" pattern="^(.*).asmx$" />
                <add input="{HTTPS}" pattern="^ON$" />
              </conditions>
            <action type="Redirect" url="http://{HTTP_HOST}{REQUEST_URI}" />
        </rule>

Should be HTTP:
http://www.homepage.com/services/service.asmx

Should be HTTP:
http://www.homepage.com/service.asmx

Should be HTTPS:
http://www.homepage.com

Should be HTTPS:
http://www.homepage.com/stuff/morestuff.htm

2

Answers


  1. Chosen as BEST ANSWER

    0

    I have Windows hosting with Host Gator. When I enable SSL via their Plesk platform, I assume it writes a bunch of rules including: redirecting all HTTP to HTTPS

    I have some legacy ASMX web services which still need to be accessed on HTTP, so I want any attempt to access those via HTTP to remain on HTTP, until I have the chance to roll out new changes (My web services have their own Web.config files in sub-dirs from the main website)

    I have added the following into the Web.config for the ASMX service, but i'm experiencing problems. It gets caught in an endless redirect loop!

        <rule name="MakeAMSXHTTPOnly" stopProcessing="true">
            <match url="(.*)" />
              <conditions>
                <add input="{R:1}" pattern="^(.*).asmx$" />
                <add input="{HTTPS}" pattern="^ON$" />
              </conditions>
            <action type="Redirect" url="http://{HTTP_HOST}{REQUEST_URI}" />
        </rule>
    

    Should be HTTP: http://www.homepage.com/services/service.asmx

    Should be HTTP: http://www.homepage.com/service.asmx

    Should be HTTPS: http://www.homepage.com

    Should be HTTPS: http://www.homepage.com/stuff/morestuff.htm


  2. To allow accessing the webservice using "http" I set a rewrite rule on my site (homepage.com) to redirect to "https" only when not "asmx":

    <rule name="WebSite HTTPS Redirect" enabled="true" stopProcessing="true">
        <match url="(.*)" />
        <conditions>
            <add input="{HTTPS}" pattern="^OFF$" />
            <add input="{REQUEST_URI}" pattern=".asmx.*" negate="true" />
        </conditions>
        <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" redirectType="Permanent" />
    </rule>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search