Quantcast
Channel: All Forums
Viewing all articles
Browse latest Browse all 28058

Is URL Rewrite required for HTTP to HTTPS redirect to work?

$
0
0

I had one of our developers insert the following text into his web.config to cause all HTTP traffic to his app to be redirected to HTTPS:
    <system.webServer>
      <rewrite> 
        <rules> 
          <rule name="Redirect to HTTPS" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
             <add input="{HTTPS}" pattern="^OFF$" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="SeeOther" />
          </rule>
        </rules> 
      </rewrite>
    </system.webServer>

After the text was added, HTTP traffic to the app triggered a "500 Internal Server Error". Additionally, attempts to use the IIS GUI to review some of the app settings (such as SSL Settings) resulted in the message “There was an error while performing this operation. Details: Filename: \\?\d:\inetpub\wwwroot\appname\web.config”. No messages were written to the Event Logs. I found that if I simply installed URL Rewrite, both the 500 error and web.config error disappeared. As the http to https redirect is a pretty frequent request from our developers, I was hoping to be able to just let them control this by adding the above text to their web.configs without the Web Admins having to install URL Rewrite. Am I missing something?.. I forgot to mention earlier that we're using IIS 7.5.


Viewing all articles
Browse latest Browse all 28058

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>