Nginx 解决内容安全策略CSP(Content-Security-Policy)配置方式(漏洞修复)

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


1、修改 nginx 配置文件

在nginx.conf 配置文件中,增加如下配置内容:

add_header Content-Security-Policy "default-src 'self' localhost:8080 'unsafe-inline' 'unsafe-eval' blob: data: ;";

效果如下:

2、重启 nginx 服务

systemctl restart nginx

或者

service nginx restart

原文地址:https://www.cnblogs.com/miracle-luna/p/14274341.html