繁体   English   中英

内容安全策略style-src拒绝在Safari中加载

[英]Content Security Policy style-src refuses to load in Safari

使用Safari 11.0时,我尝试在我维护的网站上加载CSS资源时收到错误消息。 该页面在Chrome和Firefox中可以很好地加载,而在Safari中可以很好地加载,因此我不确定如何解决它。 我猜我需要修改Content-Security-Policy标头。

Safari控制台中的特定错误被Refused to load https://****.com/css/styles.css because it does not appear in the style-src directive of the Content Security Policy. 因此,无法加载styles.css文件,并且网站呈现不正确。

该网站的安全标头(通过Caddy设置)为:

Content-Security-Policy default-src 'self' https:; script-src 'self'; style-src 'self'; object-src 'none' Content-Type text/html; charset=utf-8 Referrer-Policy strict-origin Server Caddy Strict-Transport-Security max-age=31536000; includeSubDomains; preload

更改Content-Security-Policy标头值的style-src部分,使其改为style-src 'self' https://****.com 也就是说,使用实际的主机名替换https://****.com****.com

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM