Content Security Policy
一看名称就知道是安全策略,简称CSP.为了防止跨站脚本攻击。主要是定义网页可以加载对资源对范围,比如限制只能使用本站下对资源,这样就一定程度上达到目的了。
使用
在web应用内使用,有两种途径
在meta
标签内引入
<meta http-equiv="Content-Security-Policy" content="script-src 'self';style-src 'self';">
配置web服务器,比如nginx
add_header Content-Security-Policy "default-src 'self'"
配置参考值:
Tables | Are | Cool |
---|---|---|
col 3 is | right-aligned | $1600 |
col 2 is | centered | $12 |
zebra stripes | are neat | $1 |
参考链接