Repository navigation
fix(security): allow the cloudflare analytics beacon in the csp - #651
Merged
Merged
Conversation
Cloudflare injects its Web Analytics beacon at the edge. The report-only policy did not allow it, so Chrome logged a CSP issue and Lighthouse Best Practices dropped.
With automatic injection the beacon reports to /cdn-cgi/rum on the same host, so only script-src needs the Cloudflare origin.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
launchpad | 99306ee | Commit Preview URL Branch Preview URL |
Nov 23 2026, 12:48 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On production, Chrome logs a CSP issue for Cloudflare's Web Analytics beacon and Lighthouse Best Practices dropped to 79 (
inspector-issues). Locally the beacon is not injected, so the earlier allowlist check missed it.Cloudflare injects
https://static.cloudflareinsights.com/beacon.min.js/...at the edge, and the report-only policy from 1.38.0 did not allow it.The policy now allows
https://static.cloudflareinsights.cominscript-srcandhttps://cloudflareinsights.cominconnect-src(the beacon posts to/cdn-cgi/rum). The pinned source list in the spec was updated first.Note: Cloudflare's FAQ lists the script as
.../beacon.min.jsand only'self'for connect-src with automatic injection. The real script URL carries a path suffix, so a path-exact source would not match; origins are used instead.