【发布时间】:2017-10-11 18:06:11
【问题描述】:
我试图在 azure 上为我在具有角度前端的节点服务器上运行的应用程序强制执行 https。重定向有效(它转到 https 而不是 http),但它在浏览器上显示我的 app.js 文件(https://hostname.com/app.js),而不是提供角度 index.js 文件。
我的 web.config 看起来像
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<webSocket enabled="false" />
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^app.js\/debug[\/]?" />
</rule>
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}"/>
</rule>
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="app.js"/>
</rule>
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin"/>
</hiddenSegments>
</requestFiltering>
</security>
<httpErrors existingResponse="PassThrough" />
</system.webServer>
</configuration>
我做错了什么?
我已经尝试过here给出的答案
【问题讨论】:
-
我真的很难理解您的“DynamicContent”规则的需要。但我确实相信它会导致您的问题。