new: drive vas from your AI agent over MCP · Cursor, Claude Code, Windsurf
Cloudflare

Cloudflare Security Best Practices

Behind Cloudflare? The edge stops a lot of traffic. It cannot stop your app returning the wrong user's data.

Verify your app follows these best practices automatically.

These best practices are derived from the actual security findings we see in Cloudflare apps — not a generic OWASP list. Priority ordered: critical items close data-exposure gaps, high items prevent compromise, medium items reduce attack surface. Stack-specific guidance for Supabase included.

Quick Wins

Enforce email verification, minimum password requirements, and rate limiting on auth endpoints
Scan your deployed application with a security tool that understands this stack
Enforce email verification, minimum password requirements, and rate limiting on auth endpoints
Configure Content-Security-Policy, Strict-Transport-Security, X-Frame-Options, and X-Content-Type-Options in your hosting platform's config
Run a vas scan against the deployed Cloudflare app

Security Best Practices

#1Edge protection does not cover application

high

layer authorization

Implementation

Enforce email verification, minimum password requirements, and rate limiting on auth endpoints. Test auth flows as unauthenticated and cross-user to verify access controls.

#2Origin server reachable directly if its IP leaks

medium

A common failure mode in Cloudflare applications: origin server reachable directly if its ip leaks. Left unchecked, this can lead to data exposure, unauthorized access, or service abuse.

Implementation

Scan your deployed application with a security tool that understands this stack. Address the specific findings — generic best practices don't catch platform-specific misconfigurations.

#3Harden authentication

high

A common failure mode in Cloudflare applications: workers and pages functions shipping without auth checks. Left unchecked, this can lead to data exposure, unauthorized access, or service abuse.

Implementation

Enforce email verification, minimum password requirements, and rate limiting on auth endpoints. Test auth flows as unauthenticated and cross-user to verify access controls.

#4Security headers assumed to be handled by the proxy

medium

A common failure mode in Cloudflare applications: security headers assumed to be handled by the proxy. Left unchecked, this can lead to data exposure, unauthorized access, or service abuse.

Implementation

Configure Content-Security-Policy, Strict-Transport-Security, X-Frame-Options, and X-Content-Type-Options in your hosting platform's config.

Common Mistakes to Avoid

Edge protection does not cover application

Why it's dangerous:

layer authorization

How to fix:

Enforce email verification, minimum password requirements, and rate limiting on auth endpoints. Test auth flows as unauthenticated and cross-user to verify access controls.

Origin server reachable directly if its IP leaks

Why it's dangerous:

A common failure mode in Cloudflare applications: origin server reachable directly if its ip leaks. Left unchecked, this can lead to data exposure, unauthorized access, or service abuse.

How to fix:

Scan your deployed application with a security tool that understands this stack. Address the specific findings — generic best practices don't catch platform-specific misconfigurations.

Workers and Pages Functions shipping without auth checks

Why it's dangerous:

A common failure mode in Cloudflare applications: workers and pages functions shipping without auth checks. Left unchecked, this can lead to data exposure, unauthorized access, or service abuse.

How to fix:

Enforce email verification, minimum password requirements, and rate limiting on auth endpoints. Test auth flows as unauthenticated and cross-user to verify access controls.

Verify Your Cloudflare App Security

Following best practices is the first step. Verify your app is actually secure with a comprehensive security scan.

Frequently Asked Questions

What's the minimum security I need for a Cloudflare app?

The critical-priority items above are non-negotiable for any Cloudflare app that handles user data: . Everything else is iterative.

Should I run a security scan before launching a Cloudflare app?

Yes — unconditionally. The mitigations above are specific enough that a scan proves they're implemented correctly. "I followed the checklist" isn't evidence; "the scan came back clean" is.

Is Cloudflare secure by default?

Cloudflare provides secure infrastructure, but the application-layer configuration (listed above) is the developer's job. The default state of a Cloudflare app before any security work typically has at least one critical-priority issue open.

Last updated: April 2026