我有一个Angular 2应用,我只想在https上运行。重定向使用http代替https的地址的最佳方法是什么?
我已经在Angular2网站中添加了一个web.config,其中包含以下内容。请记住,这是针对IIS托管的应用程序的。现在,所有地址都重定向到https版本。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="Redirect to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句