我的Azure网站名为
djangoproj.azurewebsites.net
当我请求主页时,它会转到 http ://djangoproj.azurewebsites.net。我知道azure中的所有项目都受SSL保护,当我输入 https ://djangoproj.azurewebsites.net时,它运行正常!我可以通过https访问该网站。但是如何在天蓝色中将其设为默认https?因为当我打电话给主页时,它会默认提供 http 响应,直到我强行指定 https 。
如何在azurewebsite中创建默认https?
答案 0 :(得分:1)
当设置为SECURE_SSL_REDIRECT
时,设置True
会将所有流量重定向到https。
答案 1 :(得分:1)
在您的web.config中(例如,存储库根目录中的web.3.4.config),将以下规则附加到规则部分:
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
我在Azure App服务上的django 1.9应用程序中进行了生产。