Skip to content

Site: strict CSP with per-request nonce, HSTS, X-Frame-Options, noindex on pages.dev - #19

Merged
dpdev69 merged 1 commit into
mainfrom
claude/upright-security-headers
Oct 20, 2026
Merged

dpdev69 merged 1 commit into
mainfrom
claude/upright-security-headers

Conversation

@dpdev69

@dpdev69 dpdev69 commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Requested by Boss

Before: upright.hellobasalt.dev sent only nosniff and a referrer policy. It had no Content-Security-Policy, HSTS or X-Frame-Options, and the upright-2ev.pages.dev preview host could be indexed.

After: every page sends a strict CSP with no 'unsafe-inline' for scripts, plus HSTS, X-Frame-Options: DENY and a Permissions-Policy. Each HTML response gets a fresh nonce, so Cloudflare's injected bot-check script can still run. Responses on *.pages.dev carry X-Robots-Tag: noindex, and the custom domain stays indexable.

How: site/_headers holds the policy. The one inline script (adding the "js" class) is allowed by its sha256 hash. functions/_middleware.js adds the per-request nonce on HTML responses, as on the hub (hellobasalt.dev PR #7), and site/_routes.json keeps the function off static files. Tested with wrangler pages dev: the nonce changes on every request, the console is clean on / and /mx-vertical, and the page renders at phone and desktop width.

🤖 Generated with Claude Code

…ex on pages.dev

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@dpdev69 dpdev69 self-assigned this Oct 20, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying upright with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8b5c00f
Status: ✅  Deploy successful!
Preview URL: https://db9ef4d2.upright-2ev.pages.dev
Branch Preview URL: https://claude-upright-security-head.upright-2ev.pages.dev

View logs

@dpdev69
dpdev69 merged commit 9abf273 into main Oct 20, 2026
4 checks passed
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