我使用的是在nginx里解决的,方便快捷

在 server {}对象块中添加如下代码

在nginx.conf里添加

add_header Content-Security-Policy "default-src 'self';";

更多推荐

Content Security Policy (CSP) not implemented漏洞