Skip to main content
AIDevOps
  • Learn
  • Learning Paths
  • Practice
  • Open Source
  • Books
  • Engineering

    AI DevOpsThe full map of building and operating AI servicesLLMOpsLLM deployment · evaluation · observabilityHands-on ProjectsBuild AI Agent projects

    Knowledge

    DocsTechnical documentationBlogEngineering articlesPloggerDevelopment log feed

    Validate

    Certification3-level skills certification · coming soon
AI Models
LlamaTutorial|MistralTutorial|GemmaTutorial|DeepSeekTutorial|QwenTutorial
☁️ Cloud
Cloud Intro & RoadmapAWSGCPAzureNCPCloudflare
🤖 AI Applied Development
Applied AI Intro & RoadmapHugging FaceLangChainLlamaIndexLLMOps|LangGraphMCPMulti-AgentAgent Evaluation
🧠 AI Core
AI Intro & RoadmapML FundamentalsLLM Fundamentals|Python AIC++|PyTorchTensorFlowJAX
🧠 AI Agent Development
Finance AI AgentLLM API ServerStock Investing AgentAIOps AI AgentEducation AI AgentCoding AI Agent
🌱 Spring Cloud
Spring Intro & RoadmapSpring Cloud GatewaySpring BootJava|Spring AISpring SecuritySpring BatchSpring JPA
🐳 DevOps
DevOps Intro & RoadmapLinuxDockerCI/CD|Kubernetes BasicsK8s AdvancedPrometheusGrafana
🧱 Infrastructure
Infrastructure Intro & RoadmapNginxRedis
🎨 Frontend
Frontend Intro & RoadmapJavaScriptTypeScript|ReactNext.js|VueNuxt|Electron
📱 Mobile
Mobile Intro & RoadmapKotlinAndroidFlutter
⚙️ Backend
Backend Intro & RoadmapPython BasicsFastAPIDjangoFlask|CGoGinNode.js
💾 Database
DB Intro & RoadmapCore SQLOracleMySQLPostgreSQL|MongoDBVector DB
🧪 Testing
k6JMeternGrinder
AIDevOps

Engineering AI. From Code to Production.
An engineering learning platform for building and operating AI and AI Agents

Learn

  • All Guides
  • Learning Paths
  • AI Tutorial
  • Practice
  • Books

Resources

  • AI DevOps
  • LLMOps
  • Hands-on Projects
  • Docs
  • Blog
  • Plogger
  • Open Source
  • Certification (coming soon)

Start Here

  • AI Core Roadmap
  • AI Applied Development Roadmap
  • Spring Cloud Roadmap
  • DevOps Roadmap
  • Infrastructure Roadmap

 

  • Cloud Roadmap
  • Frontend Roadmap
  • Mobile Roadmap
  • Backend Roadmap
  • Database Roadmap
© 2026 AIDevOps. All rights reserved.
Terms of ServicePrivacy PolicySitemaptestforge.kr
  1. Home
  2. Learn
  3. Cloud
  4. Cloudflare
Guide to Cloudflare Edge & Serverless

⚡ Cloudflare Complete Guide

Visitors

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.

  • Cloud Native Engineer →
Serverless APIs on WorkersStatic web deployment on PagesTunneling with Cloudflare TunnelWrangler CLI scripts

Contents

0 / 10
  1. How to use this guide
  2. Architecture diagrams
  3. Serverless APIs on Workers
  4. Tunneling with Cloudflare Tunnel
  5. DNS & CDN proxy caching
  6. Wrangler CLI commands
  7. Cloudflare design
  8. Operating standards
  9. Verification strategy
  10. Frequently asked questions
Contents 10 sections
  1. How to use this guide
  2. Architecture diagrams
  3. Serverless APIs on Workers
  4. Tunneling with Cloudflare Tunnel
  5. DNS & CDN proxy caching
  6. Wrangler CLI commands
  7. Cloudflare design
  8. Operating standards
  9. Verification strategy
  10. Frequently asked questions

How to use this guide

How to read it

Understanding Cloudflare as a real-world workflow

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.
index.tsTYPESCRIPT
export default {
  async fetch(request: Request, env: any): Promise<Response> {
    const url = new URL(request.url);
    if (url.pathname === "/api/health") {
      return new Response(JSON.stringify({ status: "healthy", edge: "cloudflare-workers" }), {
        headers: { "Content-Type": "application/json" }
      });
    }
    return new Response("Not Found", { status: 404 });
  }
};

Tunneling with Cloudflare Tunnel

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 in
cloudflared tunnel login

# Create a local tunnel
cloudflared 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 tunnel
cloudflared 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).

Tip

  • API responses that change infrequently can be served from the edge cache by setting the Cache-Control header.
  • With Page Rules or Cache Rules you can define fine-grained per-path caching and exception rules.

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 project
npx wrangler init my-worker

# Start the local dev server (hot reload)
npx wrangler dev

# Final deployment to the Workers edge network
npx 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 pointQuestion to askPractical guideline
BoundariesWhich parts of the Cloudflare code are most likely to change?Separate input/output, configuration, external integrations, and the core rules.
StateWhere is state created and where does it go away?Make the owner and lifecycle of state visible in the code.
FailureWhat 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.

Tip

  • Proxy status (orange cloud)
  • Wrangler local mocking
  • Cloudflare Tunnel credentials security
  • Edge Cache Rules validation

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 axisHow to verifyDefinition of done
CorrectnessAutomate the normal/failure cases.The core scenarios pass reproducibly.
Regression preventionWhen fixing a bug, leave the same case behind as a test.The same failure is not deployed again.
OperabilityCheck 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.

← Previous guideNCP