🔗 Source Repository: https://github.com/itexpatchina/edgetunnel-cloudflare-pages-guide
title: “Setting Up EdgeTunnel on Cloudflare Pages: Complete Bilingual Guide | Cloudflare Pages 部署 EdgeTunnel 完整双语指南” date: 2026-10-10 description: “A complete bilingual guide on forking cmliu/edgetunnel to your GitHub account (itexpatchina), deploying on Cloudflare Pages, binding custom domains, and optimizing clean IPs. | 基于 cmliu/edgetunnel 开源项目的 Cloudflare Pages 部署与优选 IP 进阶指南。” tags: [“Cloudflare”, “EdgeTunnel”, “DevOps”, “Networking”, “Serverless”] draft: false
🚀 Cloudflare Pages 部署 EdgeTunnel 完整双语实战指南
🔗 Original Open-Source Project / 原开源项目: cmliu/edgetunnel
EdgeTunnel is a lightweight, serverless WebSocket routing gateway engineered to run directly inside Cloudflare Workers & Cloudflare Pages.
📋 Pre-requisites / 准备工作
Before starting, ensure you have:
- A Cloudflare Account (Free tier is fully sufficient).
- A Custom Domain Name added and active on Cloudflare DNS.
- A Generated UUID (Version 4 UUID) to secure your tunnel.
Generate a UUID on Linux/macOS:
uuidgen
🛠 Step 1: Fork or Clone cmliu/edgetunnel to Your GitHub Account / 第一步:将 cmliu/edgetunnel 导入至个人 GitHub 账号 (itexpatchina)
- Fork or Clone the official repository
https://github.com/cmliu/edgetunnelinto your personal GitHub account (itexpatchina). (在 GitHub 上将官方原仓库cmliu/edgetunnelFork 或 Clone 到您的个人账号itexpatchina下,可命名为edgetunnel-cloudflare-pages-guide)。 - Repository structure:
repository/ ├── worker.js # Core WebSocket worker script ├── index.html # Landing page UI └── README.md # Deployment tutorial
☁️ Step 2: Deploy to Cloudflare Pages / 第二步:部署至 Cloudflare Pages
- Log into your Cloudflare Dashboard.
- Navigate to Workers & Pages -> Create Application -> Pages.
- Connect to Git and choose
edgetunnel-cloudflare-pages-guide. - Configure deployment settings:
- Project Name:
my-edgetunnel - Production Branch:
main - Framework Preset:
None - Build Output Directory:
/
- Project Name:
- Click Save and Deploy.
🔐 Step 3: Configure Environment Variables / 第三步:配置环境变量
In Pages project settings (Settings -> Environment Variables):
| Variable Name | Description |
|---|---|
UUID | Your secure authentication UUID string |
PROXY_IP | Optional fallback proxy IP endpoint |
🌐 Step 4: Bind Custom Domain & Optimize Clean IPs / 第四步:绑定自定义域名与优选 IP 加速
- In Cloudflare Pages project dashboard, click Custom Domains.
- Add your designated subdomain (e.g.
tunnel.example.com). - Cloudflare automatically provisions SSL/TLS certificate.
Step 5: Connection Parameters
Configure your client application with:
- Protocol: WebSocket
- Address / Server:
tunnel.example.com - Port: 443
- UUID: Your configured UUID
- Transport / Protocol: ws (WebSocket)
- Host / Header:
tunnel.example.com - TLS: Enabled
Step 6: Route & Latency Optimization
- Locate low-latency Cloudflare edge IP endpoints.
- Set client Server Address to the optimized IP while keeping Host and SNI set to
tunnel.example.com.
Verification & Testing
- Connect to the WebSocket endpoint.
- Query network status in terminal.
- Confirm that the returned IP belongs to Cloudflare global ASN.
Summary
Deploying EdgeTunnel on Cloudflare Pages gives you a resilient, zero-maintenance serverless network endpoint hosted on Cloudflare edge network at zero cost.