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 请求。

  • 相关阅读:
    swift制作framework过程
    Redis学习
    Mysql vs NoSql vs NewSql
    Mysql实践
    跨库分页解决方案[转]
    二分查找解题套路框架 [转]
    Service Mesh [转]
    Golang Case
    [转]分布式服务限流
    保险
  • 原文地址:https://www.cnblogs.com/anycc/p/14715351.html
Copyright © 2011-2022 走看看