Developers
Docs
Learning
Blog
Open Edge
Resources
Developers
Examples
Experience our products effectively with examples
Edge Functions
Access control
Caches
Combination
Crypto
Fetch
Generation
Geo
Header
HTML
Images
JSON
Media
Modification
Redirction
Signature
Stream
Set Cookie
An Edge Function is used to set cookies on a user's device, typically by adding a Set-Cookie header to the HTTP response.
Header
Modification
Referer-based Hotlink Protection
An Edge Function is used to enforce Referer hotlink protection by checking the Referer field in the HTTP request header to determine the request's origin.
Access control
Header
RSA Digital Signature
An Edge Function is used the Web Crypto API to implement RSA signing and signature verification.
Crypto
Signature
HMAC Digital Signature
An Edge Function is used the Web Crypto API to implement HMAC signing and signature verification.
Crypto
Signature
Combine Data in Streaming Mode
An Edge Function fetches and merges multiple resources, then serves the combined stream to a client.
Combination
Fetch
Stream
Using the Cache API
Fetch a remote jQuery.js resource, and the Cache API is called to cache the resource to an EdgeOne edge node.
Caches
Protecting Data from Tampering
Demonstrating how to use an edge function to verify whether the response content sent from the origin server is tampered with.
Access control
Signature
Renaming Downloaded Files
The modification of the Content-Disposition in the response headers achieves the modification of the downloaded file name according to the fileName parameter in the request URL.
Modification
Redirect based on the Location
An Edge Function is used to automatically redirect the client to the target URL corresponding to their region by identifying the client's region.
Geo
Redirction
Request Redirct
An Edge Function is used to implement the redirection of the request, returning a 302 response to the client.
Redirction
Remote Authentication
An Edge Function is used to implement remote authentication.
Access control
Fetch
Modify Response Header
An Edge Function is used to add, delete, or modify response headers.
Header
Modification
Modify Request Header
An Edge Function is used to add, delete, or modify request headers.
Header
Modification
Obtain Client Geo Info
An Edge Function is used to obtain client geo-location data.
Geo
Fetch Remote Resource
An Edge Function is used to fetch a remote resource and send it to the client.
Fetch
Request Header Authentication
An Edge Function is used to validate the request headers, implementing basic access control.
Access control
Header
Streaming Response
An Edge Function is used to generate an HTML page, and send it to the client using a streaming mode.
Generation
HTML
Stream
Return JSON
An Edge Function is used to generate a JSON object, and the JSON object is accessed and previewed from a browser.
Generation
JSON
Return HTML
An Edge Function is used to generate an HTML page, and the HTML page is accessed and previewed from a browser.
Generation
HTML
M3U8 File Rewrite and Authentication Configuration
A .m3u8 file is rewritten to support TypeA authentication that controls access to .m3u8 files and .ts segments. You can modify the code as needed to support other authentication methods.
Media
Resizing Image
Demonstrating how to identify the client type via User-Agent in the request header, use fetch API to get the image from the origin, and convert it to the format required by the browser.
Images
Media
Image Adaptive WebP
Determining whether the request header Accept contains image/webp.
Images
Media
Caching POST Requests
Demonstrating how to use an edge function to cache POST requests.This example demonstrates how to use an edge function to cache POST requests.This example demonstrates how to use an edge function to cache POST requests.This example demonstrates how to use an edge function to cache POST requests.This example demonstrates how to use an edge function to cache POST requests.this example demonstrates how to use an edge function to cache post requests.
Caches
A/B Test
Cookies are used to store session information and perform A/B testing on requests. This example demonstrates how to use an edge function to perform A/B testing.
Access control
Edge Functions
Access control
Caches
Combination
Crypto
Fetch
Generation
Geo
Header
HTML
Images
JSON
Media
Modification
Redirction
Signature
Stream