Edge Developer Platform
  • Edge Functions
    • Overview
    • Getting Started
    • Operation Guide
      • Function Management
      • Web Debugging
      • Function Trigger
      • Environment Variable
    • Runtime APIs
      • addEventListener
      • Cache
      • Cookies
      • Encoding
      • Fetch
      • FetchEvent
      • Headers
      • Request
      • Response
      • Streams
        • ReadableStream
        • ReadableStreamBYOBReader
        • ReadableStreamDefaultReader
        • TransformStream
        • WritableStream
        • WritableStreamDefaultWriter
      • Web Crypto
      • Web standards
      • Images
        • ImageProperties
    • Sample Functions
      • Example Overview
      • 301 Redirect
      • Obtaining Client URL Information
      • Customization Based on Client Geo Location
      • Obtaining Client Geo Location Information
      • Batch Redirect
      • Returning an HTML Page
      • Returning a JSON Object
      • Fetch Remote Resources
      • Authenticating a Request Header
      • Modifying a Response Header
      • Performing an A/B Test
      • Setting Cookies
      • Performing Redirect Based on the Request Location
      • Using the Cache API
      • Caching POST Requests
      • Responding in Streaming Mode
      • Merging Resources and Responding in Streaming Mode
      • Protecting Data from Tampering
      • Rewriting a m3u8 File and Configuring Authentication
      • Adaptive Image Resize
      • Image Adaptive WebP
      • Customize Referer restriction rules
      • Remote Authentication
      • HMAC Digital Signature
      • Naming a Downloaded File
      • Obtaining Client IP Address
    • Best Practices
      • Adaptive Image Format Conversion via Edge Functions

Function Trigger

Scenarios

This feature applies to the following operations for function trigger rules under a Site:
Supports adding, deleting, modifying, and querying function trigger rules under a Site.
Execution methods supported: execute a specific function, execute different functions based on weight, and execute different functions based on region.
Supports quickly adjusting the priority of trigger rules, which are executed in sequential order by rule number. If a request URL matches multiple rules, only the rule with the smallest sequence number is executed, and subsequent rules are not executed.

Directions

Creating a triggering rule

1. Log in to the Tencent Cloud EdgeOne console, enter Service Overview in the left menu bar, and click the site to be configured under Website Security Acceleration.
2. On the site details page, click Edge Functions > Function Triggers. On the Function Trigger page, click the

icon to the right of the rule list.
Configuration Item
Configuration Description
Description
Optional field, supports a maximum of 50 characters.
Trigger Condition
Select the matching type, operator, and value as needed. For more parameter descriptions, please refer to the Rule Engine.
Execute Function
Execute a specific function: Requests matching the trigger condition will directly execute the specified edge function.
Execute different functions based on weight: Functions are executed according to weight, with a configurable range of 1-100. The total weight must equal 100, and each weight must correspond to a different execution function. Supports a maximum of 5 functions.
Execute different functions based on region: Functions are executed according to the specified country/region. Supports a maximum of 5 functions. The selected countries/regions must not overlap, and each country/region must correspond to a different execution function. If the execution does not match any configured region, the function for the default region will be executed.

3. Click OK to complete the creation.

View and Modify Trigger Rules

1. Query Trigger Rules

On the Trigger Configuration page, click

to the right of the Rule List. Enter the Rule ID keyword in the search input box to complete the query.




2. Edit Trigger Rules

2.1 On the Trigger Configuration page, select the rule you want to modify and click Edit.
2.2 In the Edit Trigger Rule dialog box, modify the relevant parameters and click OK to finish editing the trigger rule.




3. Delete Trigger Rules

3.1 On the Trigger Configuration page, click the priority adjustment icon

to the right of the Rule List.
3.2 Find the rule to delete and click the

icon.




4. Adjust Trigger Rule Priority

4.1 On the Trigger Configuration page, click the priority adjustment icon

to the right of the Rule List.
4.2 Find the rule. Click the

icon to move the rule up by one row or the

icon to move the rule down by one row. Then, click Save.
Note:
If the request URL matches multiple triggering rules, such as Rules 01 and 02 in the following figure, only the triggering rule on the top will be executed. In this example, only Rule 01 will be executed.