检测到目标Content-Security-Policy响应头缺失

详细描述

HTTP 响应头Content-Security-Policy允许站点管理者控制用户代理能够为指定的页面加载哪些资源。除了少数例外情况,设置的政策主要涉及指定服务器的源和脚本结束点。

Content-Security-Policy响应头的缺失使得目标URL更易遭受跨站脚本攻击。

解决办法

将您的服务器配置为发送“Content-Security-Policy”头。对于 Apache,请参阅:
http://httpd.apache.org/docs/2.2/mod/mod_headers.html
对于 IIS,请参阅:
https://technet.microsoft.com/pl-pl/library/cc753133%28v=ws.10%29.aspx
对于 nginx,请参阅:
http://nginx.org/en/docs/http/ngx_http_headers_module.html


实战
Content-Security-Policy: policy

IIS配置

在这里插入图片描述

在这里插入图片描述

校验

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/lxyoucan/article/details/131729976