nginx解决内容安全策略CSP(Content-Security-Policy)配置方式(项目实战亲测使用)

下面这段配置拷贝到配置文件即可,注意顺序不能乱

		add_header Content-Security-Policy "default-src 'self' static4.segway(该地址按需修改) 'unsafe-inline' 'unsafe-eval' blob: data: ;";
        add_header X-Xss-Protection "1;mode=block";
        add_header X-Content-Type-Options nosniff;

执行结果:

更多推荐

nginx解决内容安全策略CSP(Content-Security-Policy)配置方式