Angular 2 – 始终重定向到https://而不是使用http://
发布时间:2020-12-17 07:34:28 所属栏目:安全 来源:网络整理
导读:我有一个Angular 2应用程序,我只想在https上运行. 重定向使用http的地址以使用https的最佳方法是什么? 我已经向Angular2站点添加了一个web.config,其中包含以下内容.请记住,这是针对IIS托管的应用程序. 现在,所有地址都重定向到https版本. ?xml version="1.
我有一个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> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |