網(wǎng)站導(dǎo)入部署SSL證書(shū)后,瀏覽器還是提示不安全,不出現(xiàn)綠色小鎖圖標(biāo);
打開(kāi)瀏覽器控制臺(tái),顯示
Mixed Content: The page at 'https://xxx.com/'' was loaded over HTTPS, but requested an insecure image 'http://xxx.com/uploads/1.png'.
原因:在當(dāng)前頁(yè)面中調(diào)用了http資源
解決辦法:在header中價(jià)格Upgrade-Insecure-Requests,讓瀏覽器將本站的所有http連接升級(jí)為https連接
添加header方法如下所示:
1、Nginx
Nginx配置:
server {
listen 80;
server_name test;
add_header Content-Security-Policy "upgrade-insecure-requests"
}
2、Apache
在網(wǎng)站根目錄下的 .htaccess 文件中定義
Header add Content-Security-Policy upgrade-insecure-requests
3、IIS
在網(wǎng)站根目錄下添加