Most sites that sit behind Cloudflare only use a fraction of what the platform offers. The free and pro tiers alone give you enough to lock a site down hard — strict transport security, a real content security policy, DNS-level email authentication, and account-level controls that matter more than any of the per-request settings. When we harden a client’s Cloudflare setup, we work through the same checklist every time. Here’s what’s actually on it, and two gotchas worth knowing before you start.
The baseline every production site should have
Transport and headers. HSTS with a long max-age and includeSubDomains, TLS minimum 1.2, Always Use HTTPS, and automatic HTTPS rewrites. On top of that, a small set of response headers that cost nothing and close real gaps: X-Frame-Options: DENY (or frame-ancestors 'none' in your CSP) to stop clickjacking, X-Content-Type-Options: nosniff, a sane Referrer-Policy, and Cross-Origin-Opener-Policy so the page can’t be pulled into another origin’s browsing context.
A strict Content Security Policy. script-src 'self' with no unsafe-inline and no blanket third-party allowances is the single biggest lift for a marketing or business site, because it closes off the most common XSS and supply-chain injection paths in one line. It also forces you to actually know every third-party script your site loads — which is a feature, not a cost.
Permissions-Policy. Disable camera, microphone, geolocation, and anything else the site doesn’t use. Most sites don’t use any of it, so this is a free win.
A disclosure policy. /.well-known/security.txt with a contact address and an expiry date. It costs five minutes and tells a researcher who finds something exactly where to report it instead of guessing or going public first.
DNS-level email authentication. SPF, DKIM, and DMARC are not optional anymore if the domain sends any mail at all — including transactional mail from a contact form. A domain with no DMARC record is trivially spoofable, and mailbox providers increasingly treat the absence of one as a trust signal against you, not just a missing nice-to-have.
Gotcha #1: a strict CSP will silently eat your analytics beacon
If you add Cloudflare Web Analytics (or any third-party analytics snippet) to a site that’s already running script-src 'self', don’t be surprised when the dashboard stays empty. The beacon script and its reporting endpoint are both off-origin, and a strict script-src with no explicit allowance for the analytics domain will block the script from loading — or load it but have the browser refuse the outbound beacon call under connect-src. The failure is silent: no error gets surfaced to anyone who isn’t specifically checking the browser console or the network tab, so it’s easy to ship this and only notice weeks later when someone asks why traffic numbers look wrong.
The fix is straightforward once you know to look for it: add the specific analytics host to both script-src and connect-src rather than loosening the policy generally, and verify the beacon actually fires by watching the network tab on a real page load — not just “the script tag is in the page.” If you’d rather not add any third-party origin to your CSP at all, Cloudflare’s own edge-level analytics (available without any client-side script) sidesteps the problem entirely, which is the route we now default to for CSP-strict sites.
Gotcha #2: the token is usually the weakest link, not the headers
Header and DNS hardening get the attention because they’re visible in a scanner report. The thing that actually gets exploited in the real world is almost always account-level: an API token scoped far wider than the job it was created for, never set to expire, and still active long after whoever created it stopped thinking about it. We’ve found exactly this pattern during account reviews — a single token holding account-wide write access when the automation using it only ever needed DNS edit rights on one zone.
Two fixes, and they’re cheap:
- Scope every token to the minimum it needs, on the specific zone or resource it touches, and give it an expiry. A short-lived, narrowly-scoped token that leaks is a non-event. An account-wide, non-expiring token that leaks is a full compromise.
- Enforce two-factor authentication on every account member, not just the owner. Multi-admin accounts where the original owner has 2FA on and every account added afterward doesn’t are common — which means the account’s actual security posture is only as strong as its weakest member, not its strongest.
Neither of these shows up in an automated scan of the public-facing site. Both of them are the difference between “someone found a stale token” being a non-issue and it being an incident.
The pattern underneath all of this
None of these controls are exotic. The gap is almost never “we don’t know this setting exists” — it’s that hardening gets done once at launch and never revisited as the site and its integrations grow. A CSP written for a site with no third-party scripts breaks quietly the day someone adds one. A token scoped correctly on day one accumulates permissions as automation gets bolted on. Treat a Cloudflare hardening pass as something you repeat on a schedule, not a box you check once, and most of the real-world findings above stop happening in the first place.