Back to All Cheatsheet Libraries cheatsheets

Cloudflare

Wrangler CLI reference, DNS/proxy/Workers/R2 core concepts, and a safe domain-migration walkthrough.

Total Commands: 0
Category Command Description
Authwrangler loginOpens a browser OAuth flow to authenticate the CLI with a Cloudflare account.
Workerswrangler init my-workerScaffolds a new Workers project with a default entry file and config.
Workerswrangler devRuns a Worker locally with live reload for development.
Workerswrangler deployPublishes the Worker to Cloudflare's edge network.
Storagewrangler kv namespace create NAMECreates a KV (key-value) namespace bindable to a Worker.
Storagewrangler r2 bucket create NAMECreates an R2 object storage bucket (S3-compatible, no egress fees).
Storagewrangler d1 create NAMECreates a D1 database — SQLite at the edge, queryable from a Worker.
Debuggingwrangler tailStreams live logs from a deployed Worker in real time.
Pageswrangler pages deploy ./distDeploys a static site build to Cloudflare Pages.

Platform Building Blocks

DNS & Proxy

The core service — pointing a domain's nameservers at Cloudflare enables both DNS resolution and the orange-cloud proxy for any record.

Workers

Serverless JavaScript/WASM that runs at edge locations worldwide — near-zero cold start, billed per request/CPU time.

Pages

Static site hosting with Git-based deploys — pairs naturally with Workers/Functions for dynamic edges on an otherwise static site.

R2

S3-API-compatible object storage with no egress bandwidth fees — a common cost-driven replacement for S3 when egress dominates the bill.

WAF & Rate Limiting

Rules that block/challenge malicious traffic before it reaches the origin — configurable per-route without touching origin server config.

Page Rules / Rulesets

URL-pattern-matched behavior overrides (caching, redirects, security level) — evaluated in order, first match applies for legacy Page Rules.

The Orange Cloud

Proxied (orange)

Traffic routes through CloudflareCDN + WAF active

DNS Only (grey)

Resolves to origin IP directlyNo CDN/WAF

SSL/TLS Mode

Full (Strict) recommended

Under Attack Mode

JS challenge on every visitor

Migrating a Domain to Cloudflare

The safe order of operations to avoid an outage during the switch.

1

Let Cloudflare scan existing DNS records first

Adding the site imports the current records automatically — verify every record (especially MX for email) is present before proceeding.

2

Set SSL/TLS mode to Full (Strict) before switching nameservers

Requires a valid certificate on the origin — avoids the "Flexible" mode trap where Cloudflare-to-origin traffic goes unencrypted.

3

Update nameservers at the registrar

Propagation can take up to 24 hours — the domain keeps working on the old nameservers until it fully cuts over.

4

Layer on WAF/firewall rules once live

Start with Cloudflare's Managed Ruleset before writing custom rules — covers common attack patterns without hand-tuning.

Quick Tips

Purge cache after a deploy, not before
Purge Everything (or a targeted URL purge) clears edge caches so the new deploy is served immediately — otherwise stale assets can linger up to the configured TTL.
Grey-cloud records that shouldn't be proxied
Mail servers, SSH endpoints, and anything needing the raw origin IP should stay DNS-only — proxying breaks protocols Cloudflare doesn't forward.
Free tier already includes real DDoS protection
Unmetered DDoS mitigation is available even on the free plan — a meaningful upgrade over an unprotected origin for very little setup effort.