【发布时间】:2020-03-23 12:45:04
【问题描述】:
尝试从已部署的网站启动get 函数并收到此错误:
Refused to connect to 'https://www.themealdb.com/api/json/v2/xxx/search.php?s=apple' because it violates the following Content Security Policy directive: "default-src 'self' http://*.google-analytics.com http://www.googletagmanager.com https://*.google.com https://*.google-analytics.com https://*.googletagmanager.com https://*.gstatic.com https://*.googleapis.com https://authedmine.com https://az743702.vo.msecnd.net https://sentry.io ws://localhost:4200". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.
在 localhost 服务器上运行网站时,一切正常。
将此meta tag 添加到我的index.html 并仍然收到相同的错误消息。
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' http://* 'unsafe-inline'; script-src 'self' http://* 'unsafe-inline' 'unsafe-eval'">
【问题讨论】:
标签: angular api httprequest content-security-policy httphandler