byJoey/cfnew
Summary
CFnew is a proxy tool based on Cloudflare Workers/Pages, supporting multiple protocols such as VLESS, Trojan, xhttp. It has built-in latency testing, subscription conversion, and a graphical management panel. The v2.9.8 update implements internal subscription conversion, no longer relying on external services, and optimizes transfer performance.
View Cached Full Text
Cached at: 05/22/26, 12:15 PM
byJoey/cfnew
Source: https://github.com/byJoey/cfnew
CFnew - Terminal v2.9.8
⚠️ Important: After deployment, set the compatibility date to
2026-01-20Pages Deployment:
- Log in to Cloudflare Dashboard (https://dash.cloudflare.com/)
- Go to Workers & Pages → Select your Pages project
- Click Settings → Runtime
- Find Compatibility date, select
2026-01-20, click Save- Go back to Deployments → Create deployment → Upload files
Worker Deployment:
- Log in to Cloudflare Dashboard (https://dash.cloudflare.com/)
- Go to Workers & Pages → Select your Worker
- Click Settings → Runtime
- Find Compatibility date, select
2026-01-20, click Save
Telegram Group (https://t.me/+ft-zI76oovgwNmRh)
Key Features
- Multi-protocol support: VLESS, Trojan, xhttp, can enable multiple simultaneously
- Custom path: No longer forced to use UUID as path; you can set your own, supports multi-level paths
- Latency testing: Built-in test tool to measure IP latency, automatically fetch airport codes
- Subscription conversion: Customizable conversion service URL
- Graphical management: Configuration stored in KV, changes take effect immediately without redeployment
- API management: Support for dynamically adding/removing optimized IPs via API
- Multi-client: Supports CLASH, SURGE, SING-BOX, LOON, QUANTUMULT X, V2RAY, Shadowrocket, STASH, NEKORAY, V2RAYNG
- App wake-up: Click a button to automatically open the corresponding client
- Auto-detection: Automatically returns the correct format based on User-Agent
- Multi-language: Supports Chinese and Persian, automatically switches based on browser language
v2.9.8 Update
- Internal subscription conversion: Clash / Stash / Sing-box / Surge / Loon / Quantumult X configurations are now all generated directly by the Worker, no longer relying on any external sub-converter
- Complete rule sets: Clash uses Loyalsoldier
rule-providers; Sing-box uses MetaCubeX SRS; Surge / Loon / QuanX use ACL4SSR / blackmatrix7 remote rules - Each policy group includes “Policy Group + All Nodes”, allowing direct node switching (removed “Auto Select” url-test to avoid periodic speed test waste)
- Fixed Clash IPv6 node
serverbeing parsed as an array, and circular references between proxy groups🎯 Global Direct↔🚀 Node Select
- Complete rule sets: Clash uses Loyalsoldier
- Transport optimization: Optimized WebSocket/TCP forwarding inspired by GrainTCP — merge small uplink packets, aggregate small downlink packets, send large packets directly, and optimize VLESS parsing hot path
- Graphical ALPN: Added
alpndropdown option; leave empty to omitalpn, or chooseh3,h2,http/1.1, or combined values - Node alias simplification: Domains unified as
PreferredDomain-XX, IPv6 asIPv6Preferred-XX, IPv4 usesisp-colo-XX - KV configuration cache: 30s short window + cross-isolate version key
c_ver, no need to refresh twice after saving - SOCKS5 degraded timeout: 3.5s without data on direct connection, automatically goes to fallback
- Label: “Enable GitHub Default Preferred” changed to “Enable Custom Preferred”
- Page effects toggle:
FX: ON / OFF, persisted via localStorage - Obfuscated version
少年你相信光吗(Young man, do you believe in light?) provided, logic identical to明文源吗(Plaintext source?)
v2.9.7 Update
- Floating save button: Persistent “Save All” button at bottom right, supports
Ctrl+S/Cmd+Skeyboard shortcut- After editing any field, the button automatically enters “Unsaved” state
- Progress feedback during save/refresh
- Notification UX optimization: All blocking dialogs replaced with floating messages at top right, auto-dismiss, can be paused on hover, supports manual close
- 4 semantic types: success / info / warn / error
- Action button consolidation: Merged 4 separate save buttons from different sections into a unified floating action group
- Obfuscated version
少年你相信光吗provided, logic identical to明文源吗
v2.9.6 Update
- Compatible with Xray-core v26.3.27
- Added Hong Kong (HK) region ProxyIP and region selection
- KV read performance optimization: 5-hour memory cache, reducing KV reads by over 99%
- Invalid request blocking: Non-matching paths return 404 directly, no longer trigger KV reads
- Fixed SOCKS5 config key error when saving preferred list
v2.9.5 Update
- GitHub default preferred addresses are now disabled by default; must configure your own preferred IP source URL
- Added “Enable Original Address” toggle, allowing control over whether original address nodes are generated in the management panel (disabled by default)
- Compatibility date set to
2026-01-20
v2.9.4 Update
- Clients can now override connection-level variables (
p,wk,rm,s) via WebSocket path parameters- No need to deploy a separate Worker for each node; just write parameters in the path of the share link
- Priority: path parameter > KV/environment variable global config > auto-detection
- See “Client path parameters” below for details
v2.9.3 Update
- Added graphical custom DNS and ECH domain features
- Custom DNS server addresses (DoH format) can be set in the UI
- Custom ECH domain can be set in the UI
- Supports dynamic changes; takes effect immediately after saving
- Added
query-server-nameparameter toech-optsin Clash config, aligning with v2ray
v2.9.2 Update
- Fixed Clash configuration generation issue
v2.9.1 Update
- ECH support: Added Encrypted Client Hello (ECH) functionality
- Automatically fetches the latest ECH config on each subscription refresh
- When ECH is enabled, “TLS Only” mode is automatically enabled to avoid port 80 interference
- One-click enable/disable for ECH in the graphical interface
v2.9 Update
- Region filter: Filter preferred results by region, supports multiple selection
- Latency filter: Added “Show only fastest 10” option
- Append/Replace mode: When adding preferred results, you can either append or replace the entire list
- Result display optimization: Shows region tags and sorts by latency
- Other detail improvements
Related Tools
- Preferred IP tool: https://github.com/byJoey/yx-tools/releases
- Text tutorial: https://joeyblog.net/yuanchuang/1146.html
- Workers video tutorial: https://www.youtube.com/watch?v=aYzTr8FafN4
- Pages video tutorial: https://www.youtube.com/watch?v=JhVxJChDL-E
- Snippets video tutorial: https://www.youtube.com/watch?v=xeFeH3Akcu8
Deployment
Subscriptions auto-optimize every 15 minutes.
Basic Configuration
| Variable | Value | Description |
|---|---|---|
u | Your UUID | Required, used to access subscription and configuration UI |
p | proxyip | Optional, custom ProxyIP address and port, supports IPv4/IPv6/domain. When set, wk region matching is disabled (mutually exclusive). Can also be specified in node path |
s | Your SOCKS5 address | Optional, format: user:pass@host:port or host:port. Can also be specified in node path |
d | Custom path | Optional, e.g., /mypath or /path/to/sub. If not provided, UUID path is used. Missing leading / is automatically added |
wk | Region code | Optional, manually specify Worker region, e.g., SG, HK, US, JP. When p is set, this is disabled (mutually exclusive). Can also be specified in node path |
Protocol Configuration
| Variable | Value | Description |
|---|---|---|
ev | yes/no | Optional, enable VLESS (enabled by default) |
et | yes/no | Optional, enable Trojan (disabled by default) |
ex | yes/no | Optional, enable xhttp (disabled by default) |
tp | Custom password | Optional, Trojan password; leave empty to use UUID |
ech | yes/no | Optional, enable ECH (disabled by default) |
alpn | ALPN list | Optional, ALPN parameter for TLS nodes. Leave empty to omit (client negotiates); options: h3, h2, http/1.1, h3,h2, h2,http/1.1, h3,h2,http/1.1 |
Graphical Configuration (Recommended)
- Create a KV namespace in Workers, bind environment variable
C - After deployment, visit
/{YourUUID}to use the graphical configuration - Changes take effect immediately without redeployment
Advanced Control
| Variable | Value | Description |
|---|---|---|
yx | Custom preferred IP/domain | Optional, supports naming, format: 1.1.1.1:443#HongKongNode,8.8.8.8:53#GoogleDNS |
yxURL | Preferred IP source URL | Optional, custom IP list source; leave empty to use default |
scu | Subscription conversion URL | Optional, default: https://url.v1.mk/sub |
epd | yes/no | Optional, enable preferred domains (enabled by default) |
epi | yes/no | Optional, enable preferred IPs (enabled by default) |
egi | yes/no | Optional, enable GitHub default preferred (enabled by default) |
qj | no | Optional, set to no to enable degradation: CF direct → SOCKS5 → fallback |
dkby | yes | Optional, set to yes to generate only TLS nodes |
ech | yes/no | Optional, enable ECH (disabled by default; when enabled, automatically enables TLS-only mode) |
alpn | ALPN list | Optional, writes only to TLS node link parameters; leave empty to omit |
yxby | yes | Optional, set to yes to disable all preferred functionality |
rm | no | Optional, set to no to disable region smart matching |
ae | yes | Optional, set to yes to enable API management (disabled by default) |
KV Storage Setup (Recommended)
- Create a KV namespace in Cloudflare Workers
- Bind the KV namespace in Worker settings, variable name set to
C - Redeploy
- Visit
/{YourUUID}to use the graphical configuration
API Usage
- Download the preferred IP tool: https://github.com/byJoey/yx-tools/releases
- Enable API: Visit
/{UUID}or/{CustomPath}, find “Allow API Management”, enable and save - Add a single IP:
# Using UUID path
curl -X POST "https://your-worker.workers.dev/{UUID}/api/preferred-ips" \
-H "Content-Type: application/json" \
-d '{"ip": "1.2.3.4", "port": 443, "name": "Hongkong Node"}'
# Using custom path (if d variable is set)
curl -X POST "https://your-worker.workers.dev/{CustomPath}/api/preferred-ips" \
-H "Content-Type: application/json" \
-d '{"ip": "1.2.3.4", "port": 443, "name": "Hongkong Node"}'
- Add multiple IPs:
curl -X POST "https://your-worker.workers.dev/{UUID or CustomPath}/api/preferred-ips" \
-H "Content-Type: application/json" \
-d '[
{"ip": "1.2.3.4", "port": 443, "name": "Node1"},
{"ip": "5.6.7.8", "port": 8443, "name": "Node2"}
]'
- Clear all IPs:
curl -X DELETE "https://your-worker.workers.dev/{UUID or CustomPath}/api/preferred-ips" \
-H "Content-Type: application/json" \
-d '{"all": true}'
Features
Latency Test
Available since v2.7, enhanced filtering in v2.9
- Built-in test tool, no additional software needed; test IP latency directly on the config page
- IP sources:
- Manual input: enter IP or domain directly, supports batch (comma-separated)
- CF random IP: randomly generated from Cloudflare IP ranges
- URL fetch: get IP list from a remote URL
- Supports 1-50 concurrent threads, default 5
- Automatically fetch airport codes (e.g., SJC, LAX)
- Automatically map to Chinese airport names (e.g., SJC → San Jose)
- Automatically subtract DNS + TLS handshake time to show true latency
- Settings automatically saved to browser
- Supports filtering by region
- Supports showing only the fastest 10
- Supports append or replace mode
Multi-Protocol Support
- VLESS: enabled by default
- Trojan: supports Trojan-WS-TLS, can set custom password, uses UUID if empty
- xhttp: HTTP POST-based camouflage protocol
- Multiple protocols can be enabled simultaneously, client auto-detects
- One-click toggle in graphical interface
- Independent save buttons for protocol config
ECH (Encrypted Client Hello)
- Supports Encrypted Client Hello (ECH) for encrypted client handshake
- Auto-fetch: gets latest ECH configuration from DoH on each subscription refresh
- Prefers Google DNS, falls back to Cloudflare DNS on failure
- Smart mode: automatically enables “TLS Only” mode when ECH is enabled to avoid port 80 interference
- Graphical interface: one-click enable/disable in protocol config area
- Debug info: detailed ECH fetch process visible in browser developer tools response headers
- Response headers:
X-ECH-Status: SUCCESS or FAILEDX-ECH-Debug: detailed debug infoX-ECH-Config-Length: ECH configuration length (on success)
Custom Path (d variable)
- No longer forced to use UUID as path; set your own
- Supports multi-level paths, e.g.,
/path/to/sub - Missing leading
/is automatically added - Once a custom path is set, the UUID path is disabled
- Path can be changed anytime via graphical interface
Graphical Configuration
- Store configuration in Cloudflare KV
- Access at
/{YourUUID}or/{CustomPath} - Changes take effect immediately, no redeployment needed
- Priority: KV config > environment variables > defaults
Multi-Language Support
- Automatically selects Chinese or Persian based on browser language
- Manual switch available in top-right corner
- Language preference saved to browser
- Persian automatically enables RTL layout
Subscription Conversion Control
- Customize conversion service URL
- Independently control preferred domains, preferred IPs, and GitHub preferred
- All enabled by default
- Changes take effect immediately
API Management
- Manage preferred IPs via RESTful API, no code changes needed
- Supports batch addition
- Supports clearing all IPs
- Disabled by default, must be enabled in graphical interface
- API-added IPs and manually configured
yxvariable are automatically merged - API endpoints:
GET /{UUID or Path}/api/preferred-ips- Query listPOST /{UUID or Path}/api/preferred-ips- Add (single/batch)DELETE /{UUID or Path}/api/preferred-ips- Delete (single/all)
Client Path Parameters
New in v2.9.4. Append query parameters to the path field of a VLESS/Trojan share link to specify per-node connection-level config without deploying an additional Worker.
| Parameter | Effect | Example |
|---|---|---|
p | Override ProxyIP (supports port) | p=1.1.1.1 or p=1.2.3.4:8443 |
wk | Override Worker region | wk=jp, wk=us, wk=sg |
rm | Disable region smart matching | rm=no |
s | Override SOCKS5 proxy | s=user:pass@host:1080 |
Priority: path parameter > KV/environment variable > auto-detection
⚠️
pandwkare mutually exclusive: Settingpdirectly uses the specified ProxyIP, bypassingwkregion matching entirely. If both are written, onlyptakes effect.
Path example:
# Specify ProxyIP (do not write wk simultaneously)
/?ed=2048&p=1.1.1.1
/?ed=2048&p=proxy.example.com:443
/?ed=2048&p=[2001:db8::1]:443
# Specify region (let Worker auto-select ProxyIP for that region)
/?ed=2048&wk=jp
/?ed=2048&wk=sg&rm=no
# Specify SOCKS5 (can be combined with wk)
/?ed=2048&s=user:[email protected]:1080&wk=us
Variables not listed above (e.g.,
ev,et,yx) are subscription-generation level configs and are already past the route at WebSocket handshake; writing them in the path has no effect. They still need to be set in environment variables or KV.
Manual Region Selection
- Manually specify Worker region, overriding auto-detection
- Set via
wk=SGor graphical interface selection, or addwk=SGin node path - Supported: US, SG, JP, HK, KR, DE, SE, NL, FI, GB
Preferred Node Naming
- Subscription aliases use short names by default, no longer appending port, protocol, TLS/WS info
- Domain nodes:
PreferredDomain-01,PreferredDomain-02 - IPv6 nodes:
IPv6Preferred-01,IPv6Preferred-02 - IPv4 nodes: priority uses
isp-colo-XX, falls back toIPv4Preferred-XXwhen ISP info is missing
System Status
- Displays Worker region, detection method, ProxyIP status
- Selection logic: same region → neighboring region → other regions
Advanced Control
rm=nodisables region smart matchingqj=noenables degraded mode (CF direct → SOCKS5 → fallback)dkby=yesgenerates only TLS nodesech=yesenables ECH (automatically enables TLS-only mode)alpn=h3,h2specifies TLS node ALPN; leave empty to omityxby=yesdisables all preferred functionality
Multi-Client Support
Supports 10 clients: CLASH, SURGE, SING-BOX, LOON, QUANTUMULT X, V2RAY, Shadowrocket, STASH, NEKORAY, V2RAYNG
- Automatically generates configuration based on client type
- One-click subscription link generation in graphical interface
- Button to automatically open the corresponding client
- Auto-detects client via User-Agent and returns the correct format
- Automatically adapts optimal protocol combination for different clients
- TLS links omit
alpnby default; can be set via graphical interface oralpnconfig
Performance Optimization
- Auto-optimization every 15 minutes
- Multiple fallback options
- Smart caching reduces repeated computation
Acknowledgements
- Based on zizifn/edgetunnel (https://github.com/zizifn/edgetunnel) modifications
- ProxyIP part from cmliu (https://github.com/cmliu)
- Reverse proxy IPs from qwer-search (https://github.com/qwer-search)
- Online preferred IP interface from 白嫖哥 (https://t.me/bestcfipas)
Star History
Star History Chart (https://www.star-history.com/#byJoey/cfnew&Timeline&LogScale)
Similar Articles
@afly813: https://x.com/afly813/status/2061989786215444949
Detailed tutorial on how to use Cloudflare's free services (Workers, Pages, KV, etc.) and free domain names to build a long-term network proxy node at zero cost for accessing services like ChatGPT and Gemini.
@interjc: Easily bypass VPS IP blocking by using a Cloudflare Worker to set up a proxy service, with the VPS accessing its own API
This article introduces a method to bypass VPS IP blocking by large companies using a Cloudflare Worker to set up a proxy service, allowing normal access to services like Gemini, ChatGPT, Claude, and X.
@JiaweiShen2568: https://x.com/JiaweiShen2568/status/2057065604197355981
How to build a free VPN node using Cloudflare and a domain name—tested to stream YouTube 4K videos smoothly.
@jianshuo: Only when you can see it can you talk about understanding. I wrote ccglass; install it via npm and you can see what Claude Code is secretly sending to the large model—system prompts, 48 tools, token accounts—all laid out.
ccglass is a zero-dependency local logging reverse proxy and web dashboard that lets you see in real-time the system prompts, tools, and token usage sent by coding agents like Claude Code to the large model.
@howie_serious: https://x.com/howie_serious/status/2054778826006347949
The author shares an in-depth experience using Codex Agent, including the macify plugin update, AI Insider 2.0, and the wechat2readwise service, emphasizing its powerful features and low cost.