title: Redirect rule on azure redirects the browser to app.js file
body: <p>I was trying to enforce https on azure for my app running on node server which has an angular front-end. The redirection works(it goes to https instead of http) but it shows my app.js file(https:// hostname.com/app.js) on browser instead of serving the angular index.js file.<br>
  My web.config looks like    </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;system.webServer&gt;
      &lt;webSocket enabled="false" /&gt;
      &lt;handlers&gt;
        &lt;add name="iisnode" path="app.js" verb="*" modules="iisnode"/&gt;
      &lt;/handlers&gt;
      &lt;rewrite&gt;
        &lt;rules&gt;
          &lt;rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true"&gt;
            &lt;match url="^app.js\/debug[\/]?" /&gt;
          &lt;/rule&gt;
  
          &lt;rule name="StaticContent"&gt;
            &lt;action type="Rewrite" url="public{REQUEST_URI}"/&gt;
          &lt;/rule&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="app.js"/&gt;
          &lt;/rule&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}/" appendQueryString="true" redirectType="Permanent" /&gt;
      &lt;/rule&gt; 
        &lt;/rules&gt;
      &lt;/rewrite&gt;
      &lt;security&gt;
        &lt;requestFiltering&gt;
          &lt;hiddenSegments&gt;
            &lt;remove segment="bin"/&gt;
          &lt;/hiddenSegments&gt;
        &lt;/requestFiltering&gt;
      &lt;/security&gt;
  
      &lt;httpErrors existingResponse="PassThrough" /&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>What am I doing wrong?</p>
  
  <p>I have already tried the answers given <a href="https://stackoverflow.com/questions/20578283/how-do-you-force-express-on-node-js-in-azure-websites-to-use-https/%22here%22">here</a></p>