首页>>帮助中心>>韩国VPS部署https后浏览器提示不安全

韩国VPS部署https后浏览器提示不安全

2023/4/19 814次

此教程是针对Windows系统的用户设置,以韩国VPS设置为例:

访问网站后,按f12,浏览器提示:

Mixed Content: The page at 'https://www.xxx.com/'' was loaded over HTTPS, but requested an insecure image 'http://www.xxx.com/uploads/2018/12/3.png'. This content

原因是在https页面中,如果调用了http资源,那么浏览器就会抛出一些错误,

解决办法:在header中加入 Upgrade-Insecure-Requests,会告诉浏览器可以把所属本站的所有 http 连接升级为 https 连接,外站请求保持默认;

添加header方法:

1.iis7


或直接在网站根目录web.config中定义


 <?xml version="1.0" encoding="UTF-8"?>         <configuration>         <system.webServer>           <httpProtocol>           <customHeaders>            <add name="Content-Security-Policy" value="upgrade-insecure-requests" />           </customHeaders>         </httpProtocol>        </system.webServer>         </configuration>

2.apache

可直接在网站根目录.htaccess中定义


 <IFModule mod_headers.c>          Header add Content-Security-Policy upgrade-insecure-requests </IFModule>

3. nginx

       server {            listen        80;            server_name   (myservername);            add_header Content-Security-Policy "upgrade-insecure-requests";            location / {                    proxy_pass         http://localhost:5000;            }        }

版权声明

    声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们996811936@qq.com进行处理。