Skip to content

Commit 6b6ea2f

Browse files
authored
Merge pull request #288 from jetstreamapp/fix/csp-generation-cf-beacon
Update CSP to support Cloudflare Web Analytics
2 parents 7b4b7fb + 6ab0e48 commit 6b6ea2f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

docs/scripts/generate-csp.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ const scriptHashes = getInlineScriptHashes();
6060

6161
const csp = [
6262
`default-src 'self'`,
63-
`script-src 'self' ${scriptHashes.join(' ')}`,
63+
// static.cloudflareinsights.com / cloudflareinsights.com allow the Cloudflare Web Analytics
64+
// beacon, which Cloudflare injects at the edge (it is not present in the origin HTML)
65+
`script-src 'self' ${scriptHashes.join(' ')} https://static.cloudflareinsights.com`,
6466
`style-src 'self' 'unsafe-inline'`,
6567
`img-src 'self' data:`,
6668
`font-src 'self' data:`,
67-
`connect-src 'self'`,
69+
`connect-src 'self' https://cloudflareinsights.com`,
6870
`frame-ancestors 'none'`,
6971
`base-uri 'self'`,
7072
`form-action 'self'`,

0 commit comments

Comments
 (0)