Skip to content

fix: stop Cloudflare from injecting scripts into the landing page - #15

Merged
ribeirogab merged 1 commit into
mainfrom
fix/site-no-transform
Oct 5, 2026
Merged

ribeirogab merged 1 commit into
mainfrom
fix/site-no-transform

Conversation

@ribeirogab

Copy link
Copy Markdown
Owner

Summary

  • Cloudflare injected its Web Analytics script (static.cloudflareinsights.com/beacon.min.js) into the landing page. The page's Content Security Policy blocked it, with a console error.
  • site/public/_headers now sends Cache-Control: public, max-age=0, must-revalidate, no-transform on every response, so Cloudflare does not change the HTML (Web Analytics FAQ). Hashed files under /assets/ detach that value and keep public, max-age=31536000, immutable, no-transform.

Tests

  • Deployed and checked on https://github-file-hider.ribeiro.engineer: / and a missing page return the new Cache-Control and contain no injected script, /assets/* returns the immutable cache, and the browser console is empty on the home page.

Cloudflare injected its Web Analytics script into the HTML, which the
Content Security Policy blocked with a console error. Every response now
sends Cache-Control: no-transform, so Cloudflare leaves the HTML as
built. Hashed files under /assets/ keep a one-year immutable cache.
@ribeirogab ribeirogab self-assigned this Oct 5, 2026
@ribeirogab
ribeirogab merged commit 3c33e1f into main Oct 5, 2026
2 checks passed
@ribeirogab
ribeirogab deleted the fix/site-no-transform branch October 5, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant