web.config .htaccess 自动升级请求从http到https

admin 2020-03-23 PM 341℃ 0条

我的理解,该指令用于让浏览器自动升级请求从http到https,用于大量包含http资源的http网页直接升级到https而不会报错.简洁的来讲,就相当于在http和https之间起的一个过渡作用.

web.config

<configuration>
 <system.webServer>
  <httpProtocol>
   <customHeaders>
    <add name="Content-Security-Policy" value="upgrade-insecure-requests" />
   </customHeaders>
  </httpProtocol>
 </system.webServer>
</configuration>


.htaccess

Header set Content-Security-Policy "upgrade-insecure-requests"


标签: https

非特殊说明,本博所有文章均为博主原创。