EdgeRoutine (ER) is a lightweight and serverless computing environment provided by Alibaba Cloud CDN. ER allows you to run custom JavaScript code on CDN edge nodes. After you use the EdgeRoutine command-line interface (CLI) to deploy code to the production environment, the system automatically runs the code on all CDN edge nodes. The CDN edge nodes process requests in different regions worldwide by following the logical rules of the code.

Features of EdgeRoutine


ER is available to Alibaba Cloud accounts of GC5 or higher levels. We apologize for the inconvenience that this may have caused. For more information about public previews, see Product updates.


Traditional CDN services can only cache and distribute content, but cannot provide the computing feature to workloads. To process a large number of requests that are sent to CDN edge nodes, Alibaba Cloud CDN must redirect the requests to origin servers that support complex computing. This back-to-origin routing process consumes resources on origin servers and requires a complex origin architecture. ER provides the computing feature on CDN edge nodes. You can use ER to customize your Alibaba Cloud CDN service and process complex requests. This feature reduces the number of requests that are redirected to origin servers and accelerates content delivery. CDN edge nodes support high availability, high scalability, and global load balancing. These features allow CDN edge nodes to support computing in more scenarios. ER provides a computing environment on each CDN edge node and allows you to run custom JavaScript code on CDN edge nodes. You do not need to be concerned about the hardware configuration, region, scheduling, or auto scaling for code deployment.

How it works

ER runs on CDN edge nodes and provides a serverless JavaScript runtime environment for you to deploy JavaScript code.

How it works
  • CDN/Dynamic Route for CDN (DCDN) requests without ER: 1. The client initiates a request to the edge node gateway. → 2. If the requested content is cached in the edge node, the node directly serves the content to the client. → 3. If the requested content is not cached in the edge node, CDN/DCDN fetches the content from the origin.
  • CDN/DCDN requests with ER: 1. The client initiates a request to the edge node gateway. → 4. The request is taken over by ER and your JavaScript code is executed. → ER uses the fetch request to access the cache or fetch content from the origin (Arrow 5 or 3) or access other Internet services (Arrow 6).
    Note In the preceding figure, ER is executed behind the gateway. Therefore, CDN/DCDN-accelerated domain configurations (such as HTTPS configuration, access control, performance optimization, and cache settings) that are configured in the console will continue to take effect.


ER provides a fully integrated JavaScript runtime environment that allows you to manage the comprehensive logic of request processing. You can also use ER to enable CDN edge nodes to asynchronously retrieve content from origin servers over HTTP or HTTPS. ER can be used in a wide array of scenarios. The following table lists the scenarios that are supported by ER.
Scenario Feature
Authentication Custom Alibaba Cloud CDN authentication and asynchronous authentication
Originless responses Static content delivery
Network security
  • Anti-bot protection
  • Web Application Firewall (WAF) deployed on edge nodes
Log data
  • Automatic logging on CDN edge nodes
  • Recording of back-to-origin routing time
  • A/B testing
  • Webhooks for GitLab, GitHub, and Jenkins
  • Programming of instant messaging robots, such as Slack robots
API Gateway
  • Edge GraphQL
  • Edge gateway:
    • Network traffic throttling
    • API parameter validation
  • Prefetching content to CDN edge nodes
  • Caching content on CDN edge nodes
  • Redirecting requests from CDN edge nodes to multiple origin servers:
    • Merging content returned from multiple origin servers
    • Optimized redirection with the lowest latency
Web applications and applets
  • Edge rendering
  • Edge server-side (SSR) rendering
  • Content prefetching and reduction of web page loading time
  • Diverse services on CDN edge nodes, such as QR code generation
Beacon Capturing and analytics of edge tracking data


When you write JavaScript code, take note of the following limits:
  • The code file must be smaller than 1 MB.
  • The CPU time that is consumed to process an individual request must be less than 50 milliseconds.
  • The response time for an individual request must be less than 120 seconds.
  • The total amount of memory consumed on an individual CDN edge node must be less than 128 MB.
Note Alibaba Cloud will adjust the pricing policy and limits on JavaScript code upon the official release of ER. For more information, see the product updates.