Top 4 Pre-Launch Risks in Cloudflare Pages & Workers Production Apps
1. Missing Application Security Headers at the Edge
Cloudflare does not inject Content-Security-Policy, X-Frame-Options, Permissions-Policy, or Cross-Origin-Opener-Policy by default — leaving sites exposed to clickjacking and XSS.
2. Secrets Bundled into Frontend Assets Instead of Worker Secrets
Always store third-party API keys via wrangler secret put rather than Vite/Astro public env vars compiled into static assets.
3. Permissive CORS & Unprotected Worker API Routes
Avoid reflecting arbitrary Origin headers with Access-Control-Allow-Credentials: true on authenticated Worker endpoints.
4. Leaked Source Maps & Staging Subdomains
Ensure .js.map files are excluded from dist/ and audit both your custom domain and .pages.dev origin.
Copy-Paste Cloudflare Worker Security Header Wrapper (MIT)
// From github.com/zColdWater/vibe-security-checklist/configs/cloudflare-headers.js
const SECURITY_HEADERS = {
"Strict-Transport-Security": "max-age=63072000; includeSubDomains; preload",
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "DENY",
"Referrer-Policy": "strict-origin-when-cross-origin",
"Permissions-Policy": "camera=(), microphone=(), geolocation=()",
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Resource-Policy": "same-site",
};
export default {
async fetch(request, env, ctx) {
const res = await fetch(request);
const out = new Response(res.body, res);
for (const [k, v] of Object.entries(SECURITY_HEADERS)) out.headers.set(k, v);
return out;
},
};
Frequently Asked Questions
Should I use Cloudflare Transform Rules, _headers, or a Worker for security headers?
For static Cloudflare Pages sites, a public/_headers file is the simplest zero-overhead approach. For dynamic Workers or proxied origins, wrapping responses in a Worker or Cloudflare Response Header Transform Rule ensures every route ships consistent headers.
How much does VibeShield v7.0 cost?
Live 116-check scanning is 100% free with zero signup. Unlocking exact evidence and tailored fix scripts is $2 one-time during our Launch Special (was $9, 14-day refund guarantee).
More Stack Hardening Guides & Empirical Research
State of Vibe-Coded Web App Security (2026)
Full 6,120+ check empirical benchmark study across Vercel, Custom Domains & GitHub Pages.
Lovable Pre-Launch Security
Audit your .lovable.app or custom domain in 2 seconds before launch: check Supabase Row Level Security (RLS), leaked client A...
Cursor & Next.js Pre-Launch Security
Stop shipping NEXT_PUBLIC_ secret leaks, public .js.map source maps, and missing CSP/HSTS headers in Cursor + Next.js + Verce...
Bolt.new & Netlify Pre-Launch Security
Audit your Bolt.new / .netlify.app / Vite production site free in 2 seconds: detect VITE_ API key leaks, public .js.map sourc...
Supabase RLS Pre-Launch Security
20% of newly launched AI web apps ship live Supabase backends. Run a read-only passive RLS & service_role key leak audit in 2...
v0.dev & Vercel Pre-Launch Security
Audit your v0.dev / Vercel Next.js deployment in 2 seconds before sharing: detect missing CSP/HSTS headers, leaked NEXT_PUBLI...
Replit Agent Pre-Launch Security
Audit your .replit.app or custom Replit deployment passively in 2 seconds: catch exposed client API keys, missing Express/Fla...
Firebase & Firestore Pre-Launch Security
Audit your deployed Firebase web app passively in 2 seconds: detect open Firestore/RTDB test-mode rules, leaked service accou...