WAWS — Allow HTTPS access only


Windows Azure Web Sites supports HTTPS by default. This means you can access the site using both HTTP://yoursite or HTTPS://yoursite. Some of our customers asked about how to disable HTTP access and allow HTTPS access only for their Azure Web Sites.

The direct way is to using the sslFlags setting like below.



         <access sslFlags="ssl">




Unfortunately, this section is locked. Adding these configuration into your web.config leads to 500.19 error.

For Windows Azure Web Sites, there is UrlRewrite installed on every hosting machines. So, we can use UrlRewrite as a workaround.

By merging follow configuration into your web.config, all HTTP request will be redirected to HTTPS.



    <!-- URL Rewrite rule to redirect anyone from -->



        <rule name="Redirect to https">

          <match url="(.*)"/>


            <add input="{HTTPS}" pattern="Off"/>


          <action type="Redirect" url="https://{HTTP_HOST}/{R:1}"/>







[Updated Dec 16th, Using ApplicationHost
Config Transformation

To turn on HTTPS access only, enable the
private site extension, then create a file named applicationHost.xdt and put it
under the /site folder.



    <location overrideMode="Deny"
path="" xdt:Locator="Match(overrideMode)">



                    <access  sslFlags="Ssl" xdt:Transform="SetAttributes" />






Important: Ssl is case sensitive.

See you next time.


Wei from APGC DSI Team

Comments (0)

Skip to main content