CSP导致google recaptcha抛出错误:无法从原点加载null?

时间:2018-03-12 22:07:02

标签: javascript google-chrome recaptcha same-origin-policy content-security-policy

确切错误:

  

recaptcha__en.js:205未捕获的DOMException:无法构造   '工人':脚本在   'https://www.google.com/recaptcha/api2/webworker.js?hl=en&v=v1520231465640'   无法从原点'null'访问。

如果我完全删除CPS,则此错误消失,同时请注意我是localhost。没有在文件系统上运行

CPS政策如下所示

scriptSrc: ["'self'", "'unsafe-inline'", 'https://*.gstatic.com/', 'https://*.google.com/', 'https://*.googleapis.com'],
styleSrc: ["'self'", "'unsafe-inline'", 'https://*.gstatic.com/', 'https://*.google.com/', 'https://*.googleapis.com'],
fontSrc: ["'self'", 'https://*.gstatic.com/', 'https://*.google.com/', 'https://*.googleapis.com'],
imgSrc: ["'self'", 'data:', 'https://*.gstatic.com/', 'https://*.google.com/', 'https://*.googleapis.com'],
sandbox: ['allow-forms', 'allow-scripts'],
reportUri: '/report-violation',
objectSrc: ["'none'"],
upgradeInsecureRequests: false,
workerSrc: ["'self'", 'https://*.gstatic.com/', 'https://*.google.com/', 'https://*.googleapis.com', '*'],
frameSrc: ["'self'", 'https://*.gstatic.com/', 'https://*.google.com/', 'https://*.googleapis.com']

0 个答案:

没有答案