如何使用 bitbucket 静态站点处理 `unsafe-eval`
How to handle `unsafe-eval` using bitbucket static sites
我使用 gatsby 编写了一个静态页面并进行了部署。 :80 没问题,当我将它托管在 github 静态页面上时,控制台也没有垃圾邮件错误。
对于我在我的项目中使用的每个 <GatsbyImage/>
,我在我的静态页面上得到这个 chrome-console-error。
[Report Only] Refused to connect to '<URL>' because it violates the following Content Security Policy directive:
"connect-src bitbucket.org *.bitbucket.org bb-inf.net *.bb-inf.net analytics.atlassian.com as.atlassian.com
api-private.stg.atlassian.com api-private.atlassian.com cofs.staging.public.atl-paas.net cofs.prod.public.atl-paas.net intake.opbeat.com api.media.atlassian.com api.segment.io
xid.statuspage.io xid.atlassian.com xid.sourcetreeapp.com bam.nr-data.net sentry.io bqlf8qjztdtr.statuspage.io <URL>".
谁能告诉我 1. 理解问题 2. 正确处理它以避免所有这些控制台错误。我讨厌实时项目中的错误 ;-)
这是关于 Content Security Policy
在 Gatsby 上使用的问题。请参阅 [1] 中的更多说明。 Gatsby 不能直接与 CSP 规则一起使用。
为此,有一些插件,例如 [2] 中的插件,可以实现 CSP 规则部分由 Gatsby 生成。错误得到修复。
来源:
我使用 gatsby 编写了一个静态页面并进行了部署。 :80 没问题,当我将它托管在 github 静态页面上时,控制台也没有垃圾邮件错误。
对于我在我的项目中使用的每个 <GatsbyImage/>
,我在我的静态页面上得到这个 chrome-console-error。
[Report Only] Refused to connect to '<URL>' because it violates the following Content Security Policy directive:
"connect-src bitbucket.org *.bitbucket.org bb-inf.net *.bb-inf.net analytics.atlassian.com as.atlassian.com
api-private.stg.atlassian.com api-private.atlassian.com cofs.staging.public.atl-paas.net cofs.prod.public.atl-paas.net intake.opbeat.com api.media.atlassian.com api.segment.io
xid.statuspage.io xid.atlassian.com xid.sourcetreeapp.com bam.nr-data.net sentry.io bqlf8qjztdtr.statuspage.io <URL>".
谁能告诉我 1. 理解问题 2. 正确处理它以避免所有这些控制台错误。我讨厌实时项目中的错误 ;-)
这是关于 Content Security Policy
在 Gatsby 上使用的问题。请参阅 [1] 中的更多说明。 Gatsby 不能直接与 CSP 规则一起使用。
为此,有一些插件,例如 [2] 中的插件,可以实现 CSP 规则部分由 Gatsby 生成。错误得到修复。
来源: