在nginx里设置 让http统一变成https

未分类阅读模式

配置文件里添加

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

例如

location /
{
    proxy_pass http://192.168.0.5:22222;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    add_header Content-Security-Policy upgrade-insecure-requests;
    add_header X-Cache $upstream_cache_status;
	#Set Nginx Cache

    proxy_ignore_headers Set-Cookie Cache-Control expires;
    proxy_cache cache_one;
    proxy_cache_key $host$uri$is_args$args;
    proxy_cache_valid 200 304 301 302 1m;
}

历史上的今天
10 月
8
 
  • nginx