Azure web app redirect http to https : <p>I use Azure cloud with web app and my server side written on <code>nodejs</code>.
When web app receive a http request I want to redirect the request to https
I found the solution.
I put that to my web.config file inside the <code>rules</code> tag </p>

<pre><code>        &lt;rule name="Force HTTPS" enabled="true"&gt;
          &lt;match url="(.*)" ignoreCase="false" /&gt;
          &lt;conditions&gt;
            &lt;add input="{HTTPS}" pattern="off" /&gt;
          &lt;/conditions&gt;
          &lt;action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="false" redirectType="Permanent" /&gt;
        &lt;/rule&gt;
</code></pre>

<p>The problem is when I type in the browser "<a href="https://myURL.com" rel="noreferrer">https://myURL.com</a>" it redirect to main screen every thing ok,
but when I change https to http "<a href="http://myURL.com" rel="noreferrer">http://myURL.com</a>" it redirect to <a href="https://myURL.com/" rel="noreferrer">https://myURL.com/</a>" and add to the url "bin/www" according that the url looks like that "<a href="http://myURL.com/bin/www" rel="noreferrer">http://myURL.com/bin/www</a>", the response is: page doesn't find.</p>

<p>The question is how to redirect a clear url without added data to the url?</p>

<p>Part of my web.config file:</p>

<pre><code>&lt;rewrite&gt;
      &lt;rules&gt;
        &lt;!-- Do not interfere with requests for node-inspector debugging --&gt;
        &lt;rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true"&gt;
          &lt;match url="^bin/www\/debug[\/]?" /&gt;
        &lt;/rule&gt;
        &lt;!-- First we consider whether the incoming URL matches a physical file in the /public folder --&gt;
        &lt;rule name="StaticContent"&gt;
          &lt;action type="Rewrite" url="public{REQUEST_URI}" /&gt;
        &lt;/rule&gt;
        &lt;!-- All other URLs are mapped to the node.js site entry point --&gt;
        &lt;rule name="DynamicContent"&gt;
          &lt;conditions&gt;
            &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" /&gt;
          &lt;/conditions&gt;
          &lt;action type="Rewrite" url="bin/www" /&gt;
        &lt;/rule&gt;
        &lt;!-- Redirect all traffic to SSL --&gt;
         &lt;rule name="Force HTTPS" enabled="true"&gt;
          &lt;match url="(.*)" ignoreCase="false" /&gt;
          &lt;conditions&gt;
            &lt;add input="{HTTPS}" pattern="off" /&gt;
          &lt;/conditions&gt;
          &lt;action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="false" redirectType="Permanent" /&gt;
        &lt;/rule&gt;
      &lt;/rules&gt;
    &lt;/rewrite&gt;
    &lt;!-- 'bin' directory has no special meaning in node.js and apps can be placed in it --&gt;
    &lt;security&gt;
      &lt;requestFiltering&gt;
        &lt;hiddenSegments&gt;
          &lt;remove segment="bin" /&gt;
        &lt;/hiddenSegments&gt;
      &lt;/requestFiltering&gt;
    &lt;/security&gt;
</code></pre>

<p>Thanks for answers, Michael.</p>
