zoukankan      html  css  js  c++  java
  • [Nginx] 配置Https后无法访问http资源

    增加这个配置后,忽略http请求,然后在nginx -s reload

    add_header Content-Security-Policy upgrade-insecure-requests;

    server {
    	listen 443;
    	server_name localhost;
    	ssl on;
    	root html;
    	index index.html index.htm;
    	ssl_certificate   /etc/ssl/certs/2906065_zxacn.com.pem;
    	ssl_certificate_key  /etc/ssl/certs/2906065_zxacn.com.key;
    	ssl_session_timeout 5m;
    	ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    	ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    	ssl_prefer_server_ciphers on;
     
    	location / {
    			add_header Content-Security-Policy upgrade-insecure-requests;
    			proxy_set_header Host $host;
    			proxy_set_header X-Real-Ip $remote_addr;
    			proxy_set_header X-Forwarded-For $remote_addr;
    			proxy_pass http://localhost:8090;
    	}
    }
    
    
    
    

    在我们服务器的响应头中加入:header("Content-Security-Policy: upgrade-insecure-requests");页面是 https 的,而这个页面中包含了大量的 http 资源(图片、iframe等),页面一旦发现存在上述响应头,会在加载 http 资源时自动替换成 https 请求。

  • 相关阅读:
    centos7安装mysql5.7
    Day1:基于ECS搭建FTP服务
    sql多表语句
    SSM多表查询
    ssm中使用逆向工程
    用maven对ssm进行整合
    Maven设置本地仓和阿里云远程仓
    解决maven项目中web.xml is missing and <failOnMissingWebXml> is set to true
    SSM登陆
    理解ConcurrentMap
  • 原文地址:https://www.cnblogs.com/anycc/p/14715351.html
Copyright © 2011-2022 走看看