Learn Cloudflare edge computing and network tunneling. Master serverless frontend/backend deployment with Cloudflare Pages and Workers, safely exposing a model server on a local PC/laptop with Cloudflare Tunnel, CDN/DNS proxy caching settings, and the Wrangler CLI commands.
Intermediate
Updated Oct 1, 2026
~3 min read
7 sections
3 code examples
Learning Paths that include this guide
This guide is one step in the paths below. Study it together with the steps before and after.
Learn Cloudflare edge computing and network tunneling. Master serverless frontend/backend deployment with Cloudflare Pages and Workers, safely exposing a model server on a local PC/laptop with Cloudflare Tunnel, CDN/DNS proxy caching settings, and the Wrangler CLI commands. Rather than listing concepts, this guide is organized so you can follow the content in the order you have to make decisions on a real project.
Key perspective
Infrastructure / operations
Rather than memorizing install commands, understand the order in which traffic, runtime, observability, and incident response connect.
Serverless APIs on WorkersStatic web deployment on PagesTunneling with Cloudflare TunnelWrangler CLI scripts
Architecture diagrams
To make what you read stick, it helps to capture the flow as a picture first. The two diagrams below are reference maps you can keep coming back to while learning Cloudflare.
Learning flow
Rendering diagram…
Architecture view
Rendering diagram…
Serverless APIs on Workers
When you first open Cloudflare, the big picture matters more than individual commands. This section starts with the problems the concepts ahead were created to solve.
Cloudflare Workers is an ultra-lightweight serverless computing service that runs on the V8 runtime of the global edge network. With no container startup delay (cold start), it responds within a few milliseconds and handles API routing and token verification at very high speed on the edge, close to the frontend.
Here you look at Tunneling with Cloudflare Tunnel alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
Cloudflare Tunnel (cloudflared) safely connects a server on a local PC/laptop (for example Ollama or FastAPI) that has no public IP or sits behind a firewall to the external internet, with no port forwarding. Without opening any inbound port, it establishes an encrypted tunnel to the Cloudflare edge network from the inside and receives external calls through it.
BASH
# Install the Cloudflare tunnel client and log incloudflared tunnel login# Create a local tunnelcloudflared tunnel create local-ai-tunnel# Write config.yml (tunnel ID and local port mapping)# tunnel: <TUNNEL_ID># credentials-file: /root/.cloudflared/<TUNNEL_ID>.json# ingress:# - hostname: ai-api.aidevops.us# service: http://localhost:8000# - service: http_status:404# Run the tunnelcloudflared tunnel run local-ai-tunnel
DNS & CDN proxy caching
This section covers DNS & CDN proxy caching from a practical perspective. Instead of memorizing the concept, focus on the situations in which you would reach for it.
When the DNS record of a domain is switched to the orange cloud (Proxy status: Proxied), the Cloudflare edge receives the traffic first and automatically provides DDoS attack protection, free SSL/TLS encryption, and caching of static assets (JS, CSS, images).
Wrangler CLI commands
Here you look at Wrangler CLI commands alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
Wrangler is the official CLI tool for controlling the development, build, and deployment of Cloudflare Workers and Pages.
BASH
# Create a new Workers projectnpx wrangler init my-worker# Start the local dev server (hot reload)npx wrangler dev# Final deployment to the Workers edge networknpx wrangler deploy
Cloudflare practical design
Cloudflare practical design is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.
Cloudflare design centers on the DNS proxy being enabled, an ultra-light, async I/O oriented design for Workers, and safely exposing a local PC through Cloudflare Tunnel.
Decision point
Question to ask
Practical guideline
Boundaries
Which parts of the Cloudflare code are most likely to change?
Separate input/output, configuration, external integrations, and the core rules.
State
Where is state created and where does it go away?
Make the owner and lifecycle of state visible in the code.
Failure
What does the caller receive on failure?
Decide the timeout, fallback, and error contract first.
Cloudflare operating standards
This section covers Cloudflare operating standards from a practical perspective. Instead of memorizing the concept, focus on the situations in which you would reach for it.
Monitor real-time logs with Wrangler tail, the CDN cache hit ratio, edge CPU latency, and whether the local Tunnel connection is alive.
Cloudflare verification strategy
Cloudflare verification strategy is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.
Deploy after local mock tests with Wrangler dev, security scans of the Tunnel credentials, verification of Page Rules redirect paths, and a check of edge cache purge.
Quality axis
How to verify
Definition of done
Correctness
Automate the normal/failure cases.
The core scenarios pass reproducibly.
Regression prevention
When fixing a bug, leave the same case behind as a test.
The same failure is not deployed again.
Operability
Check the logs, metrics, and alerts.
There is a path for tracing the cause when a problem occurs.
Cloudflare: frequently asked questions
What does Cloudflare do?
It sits in front of a site and provides a CDN that serves cached content from a nearby location, DNS, DDoS protection, and a web application firewall. It also offers a developer platform: Workers for running code at the edge, static site hosting, and object storage.
What is the difference between the orange cloud and the gray cloud on a DNS record?
Orange (Proxied) means requests go through Cloudflare to the origin server, so caching, firewall, and redirect rules apply and the origin IP is hidden. Gray (DNS only) means Cloudflare only answers with the address and requests go straight to the origin. Cloudflare features require the orange cloud.
I updated the site but the old content keeps showing. What do I do?
A cached copy remains at Cloudflare or in the browser. Purge that URL or the whole cache from the dashboard, and do a hard refresh in the browser. To stop it recurring, put a content hash in file names so changed files get new addresses, and cache HTML briefly or have it revalidated every time.