Security hCaptcha的内容安全策略头/元不工作
我试图将hCaptcha嵌入到网站中,但它不会接受我在meta head中设置的内容安全策略,也不会直接在Chrome和FireFox中设置headerSecurity hCaptcha的内容安全策略头/元不工作,security,web,browser,content-security-policy,Security,Web,Browser,Content Security Policy,我试图将hCaptcha嵌入到网站中,但它不会接受我在meta head中设置的内容安全策略,也不会直接在Chrome和FireFox中设置header <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-eval' 'unsafe-inline' https://hcaptcha.com https://*.hcaptcha.com; frame-src
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-eval' 'unsafe-inline' https://hcaptcha.com https://*.hcaptcha.com; frame-src 'self' https://hcaptcha.com https://*.hcaptcha.com; style-src 'self' 'unsafe-inline' https://hcaptcha.com https://*.hcaptcha.com" />
标题的字符串相同(使用Go)。现在我只是想让meta标签正常工作。这是我在Chrome中遇到的错误:
在FireFox中:
我做错了什么?我认为它是从最新的Chrome和FireFox更新开始的,之前就已经成功了。通过配置和使用不同的主机名解决了这个问题。将localhost.com添加到/etc/hosts并访问您在localhost.com:port上的页面。噢,您在localhost上调试了ªCaptcha吗?hCAPTCHA禁止
localhost
和127.0.0.1
:。请注意,这个页面的CSP是错误的。是的,我试过了。如果您向/etc/hosts添加一个自定义主机名,它就可以工作了,这对我来说很好。不需要CPS设置。
script-src 'self' 'unsafe-eval' 'unsafe-inline' https://hcaptcha.com https://*.hcaptcha.com;
frame-src 'self' https://hcaptcha.com https://*.hcaptcha.com;
style-src 'self' 'unsafe-inline' https://hcaptcha.com https://*.hcaptcha.com