Tencent Cloud EdgeOne, an edge security and acceleration platform, now officially supports JavaScript Edge Functions, allowing developers to run custom code across 2800+ global edge nodes.
The value of edge functions is moving computation closer to the user: operations that used to wait for a round trip back to the origin now complete at the edge, shortening time-to-first-byte and reducing origin load. This matters especially in China, where cross-border origin fetching often crosses long physical links. Putting redirects, authentication, and rewriting logic on 2800+ nodes is like giving every POP a copy of your local logic. Because EdgeOne is wired into Tencent Cloud's existing console and domain system, the configuration cost is lower than you might expect — many things that used to require a separate server can now be done with an edge function.
Application Scenarios
- Request/Response Processing: URL rewriting, header modification, cookie manipulation
- A/B Testing: Distribute different versions based on user attributes
- Personalized Delivery: Provide differentiated content based on geographic location
Pricing
Free quota of 1 million invocations per month, with overage at $0.15/million invocations.
Comparison with Cloudflare Workers
For developers familiar with edge computing, Cloudflare Workers is one of the most mature edge function platforms available. Comparing EdgeOne Edge Functions with Workers helps clarify their relative strengths:
| Dimension | Tencent Cloud EdgeOne Edge Functions | Cloudflare Workers |
|---|---|---|
| Runtime | JavaScript (V8 Isolate) | JavaScript/WASM (V8 Isolate) |
| Global Nodes | 2800+ | 330+ cities, 12000+ nodes |
| Free Tier | 1 million/month | 100,000/day (~3 million/month) |
| Overage Cost | $0.15/million | $0.30/million (via Bundles) |
| Max Execution Time | 30 seconds (adjustable for Enterprise) | 30 seconds (up to 60s via Bundles) |
| KV Storage | Built-in | Workers KV (additional cost) |
| Cron Triggers | Supported | Supported |
| Sub-request Limit | 20 sub-requests | 50 sub-requests |
| China Acceleration | Excellent (full domestic node coverage) | Limited (requires China partner) |
EdgeOne Edge Functions offers clear advantages in domestic China network coverage, with lower overage costs than Workers. However, Workers has a more mature ecosystem, community support, and third-party library availability.
Applicable Scenario Analysis
Scenario 1: Domestic Site Acceleration and Security
For websites serving mainland Chinese users, EdgeOne's domestic node coverage makes it the preferred choice. Common use cases include:
- Hotlink protection: Validate Referer and User-Agent at the edge to block unauthorized resource requests
- API aggregation: Merge multiple backend API calls at the edge, reducing client request count
- Geo-blocking: Return 403 or redirect at the edge based on request IP location
Scenario 2: E-Commerce Promotional Campaigns
EdgeOne's A/B testing and personalization capabilities are ideal for e-commerce promotions. For example, during Singles' Day, edge functions can dynamically render different promotional banners based on user city and browsing history without backend code changes.
Scenario 3: Lightweight Dynamic Features for Blogs
For content-focused sites, EdgeOne Edge Functions can handle lightweight dynamic features that previously required backend involvement:
// Example: Set dark/light theme based on cookie
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const response = await fetch(request)
const theme = request.cookies.get('theme') || 'light'
if (theme === 'dark') {
// Inject dark theme CSS
return new HTMLRewriter()
.on('head', new ThemeInjector('dark'))
.transform(response)
}
return response
}
Scenario 4: API Gateway Passthrough and Security Hardening
Use Edge Functions for API authentication, rate limiting, and logging:
// Example: Simple API rate limiting
const rateLimit = new Map()
addEventListener('fetch', event => {
const ip = event.request.headers.get('X-Forwarded-For')
const now = Date.now()
const windowMs = 60000 // 1 minute window
const maxRequests = 100
const timestamps = rateLimit.get(ip) || []
const recent = timestamps.filter(t => now - t < windowMs)
if (recent.length >= maxRequests) {
return event.respondWith(new Response('Too Many Requests', { status: 429 }))
}
recent.push(now)
rateLimit.set(ip, recent)
event.respondWith(fetch(event.request))
})
Deploying an Edge Function in Practice
Using the EdgeOne console, publishing a simple function roughly goes like this:
- In the EdgeOne console, go to Edge Functions → Function Management and create a new function.
- Paste your code, save it, and validate the output in the Test panel with a sample request.
- In Trigger Rules, bind the function to a domain and path — for example, hand
/*to the function, or only/api/*. - Save and publish; propagation to edge nodes usually takes minutes. Verify with curl:
# Verify the function is live: compare origin vs edge-processed results
curl -I https://example.com/api/ping
Two things to watch. Edge functions and CDN cache rules are separate systems: if a path also matches a cache rule, requests may never reach the function — the common fix is to disable caching on function paths or place functions after the cache layer. And sub-requests issued inside a function count toward the 20-sub-request limit, so recursive calls need care.
Adoption Advice for Site Teams
- Start with simple use cases: Begin with deterministic tasks like URL rewriting or header modification, then expand to A/B testing and personalization.
- Watch the debugging experience: EdgeOne's local debugging toolchain still lags behind Workers — allocate sufficient testing time in development.
- Cost estimation: The free tier of 1 million invocations/month is sufficient for sites with daily PV under 30,000. The $0.15/million overage rate is competitive in the edge computing space.
- Dual-platform strategy: For sites serving both mainland Chinese and overseas users, consider EdgeOne for domestic traffic and Cloudflare Workers for overseas traffic as a complementary solution.
Summary
Tencent Cloud EdgeOne's Edge Functions provide developers with the ability to run code at edge nodes, suitable for A/B testing, personalized delivery, and request processing scenarios. The free tier is adequate for small to medium-scale applications. Compared with Cloudflare Workers, EdgeOne has advantages in domestic node coverage and pricing, making it ideal for site teams targeting mainland Chinese users. Start with simple scenarios, gradually familiarize yourself with the platform features, then expand to more complex edge computing needs.
Reference: Tencent Cloud EdgeOne product page https://cloud.tencent.com/product/edgeone; EdgeOne docs https://cloud.tencent.com/document/product/1552