【发布时间】:2020-04-22 18:36:51
【问题描述】:
我的 web.config 中有以下内容
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<rewrite>
<rules>
<rule name="Angular" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="index.html" appendQueryString="true"/>
</rule>
<rule name="Redirect to www" stopProcessing="true">
<match url="(.*)" />
<conditions trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="^mydomain.com$" />
</conditions>
<action type="Redirect"
url="{MapProtocol:{HTTPS}}://www.mydomain.com/{R:1}" />
</rule>
</rules>
<rewriteMaps>
<rewriteMap name="MapProtocol">
<add key="on" value="https" />
<add key="off" value="http" />
</rewriteMap>
</rewriteMaps>
</rewrite>
</system.webServer>
</configuration>
我的 angular.json 中的资产中有以下内容
"assets": [
"src/favicon.ico",
"src/assets",
"src/web.config"
],
但我的应用没有重定向。
问题是我有一个适用于 www.mydomain.com 的应用服务托管证书设置
我有两个自定义域设置 www.mydomain.com(这个允许我将绑定添加到应用服务证书) mydomain.com(未绑定,因为我无法添加证书)
所以我想我可以通过重定向来修复它以始终访问 www。但它似乎不起作用
【问题讨论】:
-
我已经更新了我的答案,没有使用应用程序网关和前门。您可以尝试一下,如果您需要进一步的帮助,请告诉我。
标签: angularjs azure url-rewriting azure-web-app-service azure-webapps