Tencent Cloud EdgeOne

Tencent Cloud EdgeOne
Tool Guide
Product Documentation©2013-2022 Tencent Cloud. All rights reserved.

Page 1 of 56

Tencent Cloud EdgeOne

Copyright Notice©2013-2024 Tencent Cloud. All rights reserved.
Copyright in this document is exclusively owned by Tencent Cloud. You must not reproduce, modify, copy or distributein any way, in whole or in part, the contents of this document without Tencent Cloud's the prior written consent.
Trademark Notice

All trademarks associated with Tencent Cloud and its services are owned by Tencent Cloud Computing (Beijing)
Company Limited and its affiliated companies. Trademarks of third parties referred to in this document are owned bytheir respective proprietors.
Service Statement
This document is intended to provide users with general information about Tencent Cloud's products and services
only and does not form part of Tencent Cloud's terms and conditions. Tencent Cloud's products or services are
subject to change. Specific products and services and the standards applicable to them are exclusively provided for in
Tencent Cloud's applicable terms and conditions.

©2013-2022 Tencent Cloud. All rights reserved.

Page 2 of 56

Tencent Cloud EdgeOne

Contents
Tool Guide
Diagnostic Tool
Self-service debugging
Speed Test Tools
Real User Monitoring
Terraform
Overview
Installing and Configuring Terraform
Configuring Site Acceleration Through Terraform
Configuring Rule Engine Through Terraform
IP Location Query©2013-2022 Tencent Cloud. All rights reserved.

Page 3 of 56

Tencent Cloud EdgeOne

Tool Guide
Diagnostic Tool
Self-service debugging：

Last updated 2023-12-18 14:49:55

Feature Introduction
If you need to confirm whether the node cache rules, custom Cache Key, and other configurations currently configuredin EdgeOne have taken effect for your resources, EdgeOne provides a self-service debugging tool to help you obtainnode cache TTL, whether the resource is cacheable, Cache key, and other information, making it easy for you todebug your business configuration. After enabling self-service debugging, you can initiate a URL request from a
specified client IP, carrying the EO-Debug-Headers: all header in the request, and view whether the resourceis cached in the node, the corresponding Cache Key value, and cache time based on the returned response headers.

©2013-2022 Tencent Cloud. All rights reserved.

Page 4 of 56

Tencent Cloud EdgeOne

Usage Scenarios
If you have configured more complex cache rules and custom cache keys in the rule engine of the console, and needto verify whether the configuration is effective, you can use this feature for verification.

Directions
For example, the domain name www.example.com under the current site example.com has been configured
to cache .jpg suffix files in EdgeOne nodes for 600 seconds; the cache Cache Key is configured to retain thespecified parameter a as the cache key. After the configuration is completed, you need to verify whether the current
configuration has taken effect, and you can follow the steps below to verify:©2013-2022 Tencent Cloud. All rights reserved.

Page 5 of 56

Tencent Cloud EdgeOne

1. Log in to the EdgeOne console, click on the site list in the left menu bar, and click on the site to be configured in thesite list.
2. On the site details page, click on Diagnostic Tools > Self-service Debugging.
3. On the self-service debugging page, click the "switch" to enable the self-service debugging feature.

4. After enabling the debugging mode, you need to set the validity period and the allowed client source. The time
range is 1-365 days, with a default of 7 days. The client IP allows for the input of 100 entries, accommodating both
IPv4 and IPv6 IP/IP segments. The notation 0.0.0.0/0 signifies the permission for all IPv4 clients to execute
debugging, while ::/0 indicates the allowance for all IPv6 clients to carry out debugging.

5. Click Save, and the allowed client IPs can debug within the effective time.
6. Initiate a curl request for verification from the specified client IP source in a Mac/Linux environment, for example:©2013-2022 Tencent Cloud. All rights reserved.

Page 6 of 56

Tencent Cloud EdgeOne

curl -voa 'http://www.example.com/test.jpg?a=1' -H 'EO-Debug-Headers: all'

：

。The

request result is as follows

In the response headers, you can see the corresponding Cache Key, cache status, and cache time for this request,
which is consistent with the configuration in the example, indicating that the current configuration has taken effect.

Related References
When the self-service debugging mode is enabled, the debug header explanations in the response are as follows:
Header Name

Configurations

Meaning of the returned value

EO-Debug-Status

Indicates whether the self-service
debugging mode is enabled.

on: activated, and the request client IP is
within the allowlist & the request time is within
the validity period;©2013-2022 Tencent Cloud. All rights reserved.

Page 7 of 56

Tencent Cloud EdgeOne

off: Off, or activated but the request time isbeyond the validity period;
forbidden: activated, but the request client IP
is not in the allowlist.

EO-DebugCacheable

The Request URL of this request,
according to the configured EdgeOne
node cache TTL, the final cacheable
status of the Request URL resourcein EdgeOne nodes.

EO-DebugCacheKey

The Request URL of this request,
according to the custom Cache key,
the final Cache key generated for theRequest URL resource in EdgeOne
nodes.

EO-DebugCacheTTLThe Request URL of this request,
according to the configured EdgeOne
node cache TTL, the final cache TTL
duration of the Request URL resourcein EdgeOne nodes.

©2013-2022 Tencent Cloud. All rights reserved.

：

yes cacheable content
no: non-cacheable content

For example:
www.example.com/test.jpg a=1,
indicating the Cache Key generated for theRequest URL resource in EdgeOne
List values, including numbers and time units.
d stands for days, h stands for hours, mstands for minutes, and s stands for seconds,
for example:
3d0h0m0s means the cache TTL is 3 days;
0d0h5m0s means the cache is 5 minutes;
0d0h0m5s means the cache is 5 seconds.

Page 8 of 56

Tencent Cloud EdgeOne

Speed Test Tools
Real User Monitoring：

Last updated 2024-01-25 11:03:32

Overview
Real User Monitoring is a feature interconnected with EdgeOne. It provides one-stop frontend monitoring solutions.
You only need to install its SDK to your project and complete simple configuration, and then it will take care of the user
page quality in an all-around manner by monitoring the page performance and frontend quality in real time, truly
enabling cost-effective usage and non-intrusive monitoring.
Note:
RUM provides a free tier of 500,000 reports per day for each application. Reports exceeding the free tier (500,000)
will be billed. The fees are not part of your EdgeOne plan but are charged by RUM. For billing details, see Billing
Overview.

Use Cases
Page performance analysis: RUM offers metrics such as firstScreenTime, TCP connection establishment duration,
time to first byte (TTFB), and SSL handshake duration. In addition, it supports latest Web Vitals standards, Google's
webpage loading speed and experience metrics, helping you optimize the user experience in an all-around manner.
User access analysis: RUM displays the business PV/UV and top access metrics of each page. It analyzes the user
access data in various dimensions including network, browser, and region, so that you can stay on top of and analyze
the user access information.
Static resource speed test: RUM supports different types of resource speed tests on image loading, CDN resource
operation, etc., so you can view diverse information such as resources used on a page and loading duration of eachresource.

Directions
1. Log in to the EdgeOne console and click Speed Test Tools > Real User Monitoring on the left sidebar.
2. If you enter the Real User Monitoring page for the first time, as this feature is based on EdgeOne and RUM, youneed to click Enable to grant the relevant permissions.

©2013-2022 Tencent Cloud. All rights reserved.

Page 9 of 56

Tencent Cloud EdgeOne

3. On the Real User Monitoring page, click Application connection.
4. In the Application connection window, enter the application name and description, select I have understoodthe billing details, and click Next.

5. Install the SDK based on the connection type.
Install the SDK by importing the <script> tag
5.1.1 On the connection guide page, copy the provided <script> tag code.

©2013-2022 Tencent Cloud. All rights reserved.

Page 10 of 56

Tencent Cloud EdgeOne

5.1.2 Import the code below <script> tag import into the <head></head> tags of the site to bemonitored.

Note:
This connection method uses the “h3-Q050” protocol, where cache-control is max-age=666 by default. To
modify cache-control , you can add the max_age parameter, such as <script src="https://cdngo.cn/aegis/aegis-sdk/latest/aegis.min.js?max_age=3600"></script> .
Install the SDK through npm
5.1 On the connection guide page, copy the first command line to import aegis sdk into your development
environment.
5.2 Then, copy the provided code to initialize the SDK in your JavaScript code.

©2013-2022 Tencent Cloud. All rights reserved.

Page 11 of 56

Tencent Cloud EdgeOne

Data Monitoring
After performing the above connection steps, go to the Page performance, Page view, and Static resource pages
to view the relevant data.

Page performance
The Page performance module supports multidimensional page performance analysis. You can analyze key pageperformance metrics such as firstScreenTime and request response through various views including performancechange trend chart, page loading waterfall plot, and regional view. For more information, see Page Performance.

Page view
The Page view module displays the page view information such as UV, PV, WAU and MAU, and supports
multidimensional page access analysis. For more information, see Page View.

©2013-2022 Tencent Cloud. All rights reserved.

Page 12 of 56

Tencent Cloud EdgeOne

Static resource
Frontend HTML pages mainly contain the following static resources: JavaScript, CSS, and image files. If such files failto load, or it takes a long time to load them, the page will be affected or even crash. To address these problems, static
resource monitoring helps you analyze the frontend static resource status. For more information, see Static Resource.

©2013-2022 Tencent Cloud. All rights reserved.

Page 13 of 56

Tencent Cloud EdgeOne

Terraform
Overview：

Last updated 2024-01-25 11:20:13

Terraform Overview
Terraform is an open-source resource orchestration tool written in Go and running on the client. It is highly scalable
based on the HashiCorp Plugin architecture. Currently, Tencent Cloud implements the TencentCloud Provider basedon Terraform plugin to manage Tencent Cloud resources through Terraform. The schematic diagram is as follows:

Based on tencentcloud-sdk-go, TencentCloud Provider offers more than 183 resources and 158 data sources acrossover 30 products, covering compute, storage, network, container service, load balancing, middleware, database, andcloud monitoring to meet your basic needs for cloudification.
For a quick start on Terraform, see tencentcloud_teo_zone and terraform-providertencentcloud/examples/tencentcloud-teo/.

Terraform Strengths
Multi-cloud orchestration
Terraform is suitable for multi-cloud solutions where you can deploy similar infrastructures in Tencent Cloud, othercloud providers, or local IDCs. You can manage resources from different cloud providers at the same time using thesame tools and similar configuration files.

Infrastructure and code

©2013-2022 Tencent Cloud. All rights reserved.

Page 14 of 56

Tencent Cloud EdgeOne

You can use the high-level configuration syntax HCL to describe an infrastructure, so that it can be codified andversioned for sharing and reuse as shown in the following example:# Create the `example.com` site with NS accessresource "tencentcloud_teo_zone" "zone" {zone_name= "example.com"# Query available plans by `zone_available_plans`
plan_type= "<your-plan-type>"
type= "full"paused= falsecname_speed_up = "enabled"©2013-2022 Tencent Cloud. All rights reserved.

Page 15 of 56

Tencent Cloud EdgeOne}# Create the DNS record of `example.com`
resource "tencentcloud_teo_dns_record" "dns_record" {zone_id= tencentcloud_teo_zone.zone.id
type
= "A"
name
= "example.com"# Enable the CDN acceleration service
mode= "proxied"
content= "<your-backend-ip>"
ttl
= 60
}

Execution plan
Terraform has a "planning" step. It runs the terraform plan command to generate an execution plan, whichshows the state of Terraform when apply is called. This allows you to avoid incidents when the infrastructure ismanipulated on Terraform, as shown in the following example:©2013-2022 Tencent Cloud. All rights reserved.

Page 16 of 56

Tencent Cloud EdgeOne

Terraform used the selected providers to generate the following execution plan. Res+ create
Terraform will perform the following actions:# tencentcloud_teo_dns_record.dns_record will be created+ resource "tencentcloud_teo_dns_record" "dns_record" {+ cname= (known after apply)+ content= "<your-backend-ip>"+ created_on= (known after apply)+ domain_status = (known after apply)©2013-2022 Tencent Cloud. All rights reserved.

Page 17 of 56

Tencent Cloud EdgeOne+ id+ locked+ mode+ modified_on+ name+ priority= (known after apply)= (known after apply)= "proxied"= (known after apply)= "example.com"= (known after apply)+ type+ status+ ttl+ zone_id= "A"= (known after apply)= 60= (known after apply)}# tencentcloud_teo_zone.zone will be created+ resource "tencentcloud_teo_zone" "zone" {+ area= (known after apply)+ cname_speed_up= "enabled"+ cname_status= (known after apply)+ created_on= (known after apply)+ id= (known after apply)+ modified_on= (known after apply)+ name= "example.com"+ name_servers= (known after apply)+ original_name_servers= (known after apply)+ paused= false+ plan_type= "sta"+ status= (known after apply)+ type= "full"+ vanity_name_servers_ips = (known after apply)+ vanity_name_servers {+ servers = (known after apply)+ switch = (known after apply)}}
Plan: 2 to add, 0 to change, 0 to destroy.
───────────────────────────────────────────────────────────────────────────────Note: You didn't use the -out option to save this plan, so Terraform can't guarante

Auto change
You can apply complex change sets to your infrastructure with minimal manual intervention. With the execution planand resource topology mentioned above, you can get an accurate picture of Terraform dynamics and avoid possible
human errors.

©2013-2022 Tencent Cloud. All rights reserved.

Page 18 of 56

Tencent Cloud EdgeOne

Remote State Management
Terraform introduces the concept of backend, a remote state storage mechanism. Currently, Tencent Cloud canmanage your tfState files through COS to avoid storing files locally and causing file losses. In addition, remote storage
makes it possible for multiple users to manage Terraform resources concurrently.

©2013-2022 Tencent Cloud. All rights reserved.

Page 19 of 56

Tencent Cloud EdgeOne

Installing and Configuring Terraform：

Last updated 2024-01-25 11:20:13
This document describes how to install and configure Terraform.

Step 1. Install Terraform
1. Go to Terraform official website and use the command line to install Terraform directly or download the binary
installation file.
2. Unzip the file and configure the global path.
Skip this step if you use the command line.
Linux and macOS
Windows
1. Run the following command to unzip the file. Replace 1.x.x with the actual version number of Terraform to beinstalled.

©2013-2022 Tencent Cloud. All rights reserved.

Page 20 of 56

Tencent Cloud EdgeOne

unzip terraform_1.x.x_linux_amd64.zip
2. Run the following command to add the current directory to the ~/.profile file.

©2013-2022 Tencent Cloud. All rights reserved.

Page 21 of 56

Tencent Cloud EdgeOne

echo $"export PATH=\\$PATH:$(pwd)" >> ~/.bash_profile
3. Run the following command to make the global path configuration take effect.

©2013-2022 Tencent Cloud. All rights reserved.

Page 22 of 56

Tencent Cloud EdgeOne

source ~/.bash_profile
1. On the desktop, right-click the This PC icon and select Properties in the pop-up menu.
2. In the pop-up window, click Advanced system settings.
3. In the System Properties window that pops up, click Environment Variables.
4. In System variables, add the absolute path of terraform.exe to Path as shown below:
This document uses Windows 10 as an example, and terraform.exe is located in D:\\xxxx\\terraform .

©2013-2022 Tencent Cloud. All rights reserved.

Page 23 of 56

Tencent Cloud EdgeOne

5. Click OK.
3. Run the following command to check whether the installation is successful.

©2013-2022 Tencent Cloud. All rights reserved.

Page 24 of 56

Tencent Cloud EdgeOne

terraform-versionIf the following information is returned (the version number may be different), the installation is successful:©2013-2022 Tencent Cloud. All rights reserved.

Page 25 of 56

Tencent Cloud EdgeOne> Terraform v1.0.10> on darwin_amd64> Your version of Terraform is out of date! The latest version> is 1.1.0. You can update by downloading from https://www.terraform.io/downloads.h

Step 2. Configure security credentials©2013-2022 Tencent Cloud. All rights reserved.

Page 26 of 56

Tencent Cloud EdgeOne

Before using Terraform for the first time, go to the TencentCloud API Key page to apply for SecretId andSecretKey . If you already have them, go to step 3.
1. Log in to the CAM console and select Access Key > Manage API Key on the left sidebar.
2. On the Manage API Key page, click Create Key to create a pair of SecretId/SecretKey .

3. You can authenticate in two ways:
Authentication by environment variable
Authentication by Static Credential
Add the following content to the environment variable configuration:
Replace <your-secret-id> and <your-secret-key> with SecretId and SecretKey obtained in
the Get credentials step.

©2013-2022 Tencent Cloud. All rights reserved.

Page 27 of 56

Tencent Cloud EdgeOne

export TENCENTCLOUD_SECRET_ID=<your-secret-id>
export TENCENTCLOUD_SECRET_KEY=<your-secret-key>
Create a provider.tf file in the user directory and enter the following content:
Replace <your-secret-id> and <your-secret-key> with SecretId and SecretKey obtained in
the Get credentials step.

©2013-2022 Tencent Cloud. All rights reserved.

Page 28 of 56

Tencent Cloud EdgeOne

provider "tencentcloud" {secret_id = "<your-secret-id>"secret_key = "<your-secret-key>"}
4. At this point, you have installed Terraform and configured the environment variable. You can now proceed to createa site through Terraform.

©2013-2022 Tencent Cloud. All rights reserved.

Page 29 of 56

Tencent Cloud EdgeOne

Configuring Site Acceleration ThroughTerraform：

Last updated 2024-01-25 11:20:13

Overview
EdgeOne has been connected to Terraform to allow for quick configuration. This document describes how to use
Terraform to configure site acceleration. For more information, see Tencent Cloud EdgeOne.

Prerequisites
1. You have installed and configured Terraform as instructed in Installing and Configuring Terraform.
2. You have connected to the site through Terraform as instructed in Creating Site Through Terraform.

Directions
1. Modify the Terraform configuration file and add the resource definitions of site acceleration configuration.
You can view the parameter definitions of the site acceleration configuration on the Terraform Provider documentation
page. Below is the tencent_teo.tf sample configuration file.

©2013-2022 Tencent Cloud. All rights reserved.

Page 30 of 56

Tencent Cloud EdgeOne

terraform {required_providers {tencentcloud = {source = "tencentcloudstack/tencentcloud"version = ">= 1.78.5"}}}
provider "tencentcloud" {secret_id = "<your-secret-id>"secret_key = "<your-secret-key>"©2013-2022 Tencent Cloud. All rights reserved.

Page 31 of 56

Tencent Cloud EdgeOne

region= "ap-guangzhou"}
resource "tencentcloud_teo_zone" "example" {zone_name = "example.com"
plan_type = "ent"tags = {"createdBy" = "terraform"}}
resource "tencentcloud_teo_zone_setting" "example" {zone_id = tencentcloud_teo_zone.example.id# Cache rule configurationcache {
follow_origin {switch = "on" # Follow the origin server}}# Cache key configurationcache_key {full_url_cache = "off" # Do not enable full path cache
ignore_case= "on" # Ignore the casequery_string {switch = "on"action = "includeCustom" # Only use the specified URL parametervalue = ["param0", "param1"]}}# HTTPS acceleration configuration of the domain namehttps {
ocsp_stapling = "on" # OCSP configuration enabled
tls_version= ["TLSv1.2", "TLSv1.3"] # Supported TLS protocol versions}# Smart compression configuration
compression {switch= "on"
algorithms = ["brotli", "gzip"]}# Region of the client IP during origin-pullclient_ip_header {switch= "on"
header_name = "EO-Client-IPCountry"}}
2. Run the terraform plan command to preview the configuration and verify whether it is correct.

©2013-2022 Tencent Cloud. All rights reserved.

Page 32 of 56

Tencent Cloud EdgeOne

PS tf-doc> terraform.exe plantencentcloud_teo_zone.example: Refreshing state... [id=zone-2ag9gej58j36]
Terraform used the selected providers to generate the following execution plan. Res+ create
Terraform will perform the following actions:# tencentcloud_teo_zone_setting.example will be created+ resource "tencentcloud_teo_zone_setting" "example" {+ area= (known after apply)+ id= (known after apply)+ zone_id = "zone-2ag9gej58j36"+ cache {©2013-2022 Tencent Cloud. All rights reserved.

Page 33 of 56

Tencent Cloud EdgeOne+ cache {+ cache_time= (known after apply)+ ignore_cache_control = (known after apply)+ switch= (known after apply)}+ follow_origin {+ switch = "on"}+ no_cache {+ switch = (known after apply)}}+ cache_key {+ full_url_cache = "off"+ ignore_case= "on"+ query_string {+ action = "includeCustom"+ switch = "on"+ value = [+ "param0",+ "param1",]}}+ cache_prefresh {+ percent = (known after apply)+ switch = (known after apply)}+ client_ip_header {+ header_name = "EO-Client-IPCountry"+ switch= "on"}+ compression {+ algorithms = [+ "brotli",+ "gzip",]+ switch= "on"}+ force_redirect {+ redirect_status_code = (known after apply)+ switch= (known after apply)}+ https {+ ocsp_stapling = "on"+ tls_version= [+ "TLSv1.2",©2013-2022 Tencent Cloud. All rights reserved.

Page 34 of 56

Tencent Cloud EdgeOne+ "TLSv1.3",]}+ ipv6 {+ switch = (known after apply)}+ max_age {+ follow_origin = (known after apply)+ max_age_time = (known after apply)}+ offline_cache {+ switch = (known after apply)}+ origin {+ backup_origins+ cos_private_access= (known after apply)= (known after apply)+ origin_pull_protocol = (known after apply)+ origins= (known after apply)}+ post_max_size {+ max_size = (known after apply)+ switch= (known after apply)}+ quic {+ switch = (known after apply)}+ smart_routing {+ switch = (known after apply)}+ upstream_http2 {+ switch = (known after apply)}+ web_socket {+ switch = (known after apply)+ timeout = (known after apply)}}
Plan: 1 to add, 0 to change, 0 to destroy.
───────────────────────────────────────────────────────────────────────────────────Note: You didn't use the -out option to save this plan, so Terraform can't guarante
3. Run terraform apply to create the site acceleration configuration.
After the terraform apply command is executed, Terraform will ask you to confirm the actions to be executed.
After confirming that everything is correct, enter yes . Then, wait for the command to complete.

©2013-2022 Tencent Cloud. All rights reserved.

Page 35 of 56

Tencent Cloud EdgeOne

PS tf-doc> terraform.exe apply
tencentcloud_teo_zone.example: Refreshing state... [id=zone-2ag9gej58j36]
Terraform used the selected providers to generate the following execution plan. Res+ create
Terraform will perform the following actions:# tencentcloud_teo_zone_setting.example will be created+ resource "tencentcloud_teo_zone_setting" "example" {+ area= (known after apply)+ id= (known after apply)+ zone_id = "zone-2ag9gej58j36"+ cache {©2013-2022 Tencent Cloud. All rights reserved.

Page 36 of 56

Tencent Cloud EdgeOne+ cache {+ cache_time= (known after apply)+ ignore_cache_control = (known after apply)+ switch= (known after apply)}+ follow_origin {+ switch = "on"}+ no_cache {+ switch = (known after apply)}}+ cache_key {+ full_url_cache = "off"+ ignore_case= "on"+ query_string {+ action = "includeCustom"+ switch = "on"+ value = [+ "param0",+ "param1",]}}+ cache_prefresh {+ percent = (known after apply)+ switch = (known after apply)}+ client_ip_header {+ header_name = "EO-Client-IPCountry"+ switch= "on"}+ compression {+ algorithms = [+ "brotli",+ "gzip",]+ switch= "on"}+ force_redirect {+ redirect_status_code = (known after apply)+ switch= (known after apply)}+ https {+ ocsp_stapling = "on"+ tls_version= [+ "TLSv1.2",©2013-2022 Tencent Cloud. All rights reserved.

Page 37 of 56

Tencent Cloud EdgeOne+ "TLSv1.3",]}+ ipv6 {+ switch = (known after apply)}+ max_age {+ follow_origin = (known after apply)+ max_age_time = (known after apply)}+ offline_cache {+ switch = (known after apply)}+ origin {+ backup_origins+ cos_private_access= (known after apply)= (known after apply)+ origin_pull_protocol = (known after apply)+ origins= (known after apply)}+ post_max_size {+ max_size = (known after apply)+ switch= (known after apply)}+ quic {+ switch = (known after apply)}+ smart_routing {+ switch = (known after apply)}+ upstream_http2 {+ switch = (known after apply)}+ web_socket {+ switch = (known after apply)+ timeout = (known after apply)}}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
tencentcloud_teo_zone_setting.example: Creating...
tencentcloud_teo_zone_setting.example: Creation complete after 1s [id=zone-2ag9gej5
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

©2013-2022 Tencent Cloud. All rights reserved.

Page 38 of 56

Tencent Cloud EdgeOne

4. Check the command execution result.
You can run terraform show to check whether the site acceleration configuration takes effect or log in to the
EdgeOne console for confirmation.

PS tf-doc> terraform state show tencentcloud_teo_zone_setting.example# tencentcloud_teo_zone_setting.example:
resource "tencentcloud_teo_zone_setting" "example" {area= "overseas"id= "zone-2ag9gej58j36"
zone_id = "zone-2ag9gej58j36"
cache {

©2013-2022 Tencent Cloud. All rights reserved.

Page 39 of 56

Tencent Cloud EdgeOne

follow_origin {switch = "on"}no_cache {switch = "off"}}cache_key {full_url_cache = "off"ignore_case= "on"
query_string {action = "includeCustom"
switch = "on"value = ["param0","param1",]}}
cache_prefresh {percent = 90
switch = "off"}client_ip_header {header_name = "EO-Client-IPCountry"
switch= "on"}
compression {algorithms = ["brotli","gzip",]
switch= "on"}
force_redirect {redirect_status_code = 302
switch= "off"}https {
http2= "on"
ocsp_stapling = "on"tls_version= ["TLSv1.2","TLSv1.3",]
hsts {
include_sub_domains = "off"©2013-2022 Tencent Cloud. All rights reserved.

Page 40 of 56

Tencent Cloud EdgeOne

max_agepreloadswitch= 0= "off"= "off"}}ipv6 {
switch = "off"}max_age {follow_origin = "on"max_age_time = 600}
offline_cache {switch = "on"}origin {backup_origins= []origin_pull_protocol = "follow"
origins= []}post_max_size {max_size = 524288000
switch= "on"}
quic {
switch = "off"}smart_routing {switch = "off"}upstream_http2 {switch = "off"}web_socket {switch = "off"timeout = 30}}

©2013-2022 Tencent Cloud. All rights reserved.

Page 41 of 56

Tencent Cloud EdgeOne

Configuring Rule Engine Through Terraform：

Last updated 2024-01-25 11:20:13

Overview
EdgeOne has been connected to Terraform to allow for quick configuration. This document describes how to use
Terraform to configure the rule engine of the EdgeOne site and differentiate subdomain name configurations.

Prerequisites
1. You have installed and configured Terraform as instructed in Installing and Configuring Terraform.
2. You have connected to the site through Terraform as instructed in Creating Site Through Terraform.

Directions
1. Modify the Terraform configuration file by adding the resource definitions of the DNS record and rule engine of the
subdomain name.
You can view the parameter definitions of the DNS record and rule engine on the Terraform Provider documentation
page. Below is the tencent_teo.tf sample configuration file.

©2013-2022 Tencent Cloud. All rights reserved.

Page 42 of 56

Tencent Cloud EdgeOne

terraform {required_providers {tencentcloud = {source = "tencentcloudstack/tencentcloud"version = ">= 1.78.5"}}}
provider "tencentcloud" {secret_id = "<your-secret-id>"secret_key = "<your-secret-key>"©2013-2022 Tencent Cloud. All rights reserved.

Page 43 of 56

Tencent Cloud EdgeOne

region= "ap-guangzhou"}
resource "tencentcloud_teo_zone" "example" {zone_name = "example.com"
plan_type = "ent"tags = {"createdBy" = "terraform"}}# DNS record of the subdomain nameresource "tencentcloud_teo_dns_record" "rule_record" {zone_id = tencentcloud_teo_zone.example.id
type
= "A"
name
= "rule.example.com"
content = "<your-backend-ip>"
mode= "proxied"
ttl

= 300

}
# Differentiated configurations of the subdomain nameresource "tencentcloud_teo_rule_engine" "rule_example" {zone_id= tencentcloud_teo_zone.example.id
rule_name = "example_rule"
status= "enable" # Enable the rulerules {# For `rule.example.com` and requests with the `mp3` or `mp4` file extension
or {
and {
target= "host"operator = "equal"values= [tencentcloud_teo_dns_record.rule_record.name]}and {target= "extension"
operator = "equal"values= ["mp4", "mp3"]}}
actions {# Use the specified `CacheKey`
normal_action {action = "CacheKey"# `CacheKey` is case-sensitive
parameters {name= "Type"values = ["IgnoreCase"]}parameters {©2013-2022 Tencent Cloud. All rights reserved.

Page 44 of 56

Tencent Cloud EdgeOne

name= "Switch"values = ["off"]}# `CacheKey` contains the `User-Agent` header
parameters {name= "Type"
Values = ["Header"]}parameters {name= "Switch"values = ["on"]}parameters {name= "Value"
values = "User-Agent"}}}# Add the specified response header
actions {rewrite_action {action = "ResponseHeader"parameters {action = "add"name= "Added-Header"values = ["Added-Value"]
}
}
}
}
}
2. Run the terraform plan command to preview the configuration and verify whether it is correct.

©2013-2022 Tencent Cloud. All rights reserved.

Page 45 of 56

Tencent Cloud EdgeOne

PS tf-doc> terraform plantencentcloud_teo_zone.example: Refreshing state... [id=zone-2ag9gej58j36]
Terraform used the selected providers to generate the following execution plan. Res+ create
Terraform will perform the following actions:# tencentcloud_teo_dns_record.rule_record will be created+ resource "tencentcloud_teo_dns_record" "rule_record" {+ cname= (known after apply)+ content= "<your-backend-ip>"+ created_on= (known after apply)+ dns_record_id = (known after apply)©2013-2022 Tencent Cloud. All rights reserved.

Page 46 of 56

Tencent Cloud EdgeOne+ domain_status = (known after apply)+ id= (known after apply)+ locked= (known after apply)+ mode= "proxied"+ modified_on= (known after apply)+ name= "rule.example.com"+ priority+ status+ ttl+ type+ zone_id= (known after apply)= (known after apply)
= 300
= "A"
= "zone-2ag9gej58j36"}# tencentcloud_teo_rule_engine.rule_example will be created+ resource "tencentcloud_teo_rule_engine" "rule_example" {+ id= (known after apply)+ rule_id= (known after apply)+ rule_name = "example_rule"+ status= "enable"+ zone_id= "zone-2ag9gej58j36"+ rules {+ actions {+ normal_action {+ action = "CacheKey"+ parameters {+ name= "Type"+ values = [+ "IgnoreCase",]}+ parameters {+ name= "Switch"+ values = [+ "off",]}+ parameters {+ name= "Type"+ values = [+ "Header",]}+ parameters {+ name= "Switch"+ values = [+ "on",]}©2013-2022 Tencent Cloud. All rights reserved.

Page 47 of 56

Tencent Cloud EdgeOne+ parameters {+ name= "Value"+ values = [+ "User-Agent",]}}}+ actions {+ rewrite_action {+ action = "ResponseHeader"+ parameters {+ action = "add"+ name= "Added-Header"+ values = [+ "Added-Value",]}}}+ or {+ and {
+ operator = "equal"+ target= "host"+ values= [+ "rule.example.com",]}+ and {
+ operator = "equal"+ target= "extension"+ values= [+ "mp3",+ "mp4",]}}}}
Plan: 2 to add, 0 to change, 0 to destroy.
───────────────────────────────────────────────────────────────────────────────────Note: You didn't use the -out option to save this plan, so Terraform can't guarante
3. Run terraform apply to create the DNS record and rule engine of the subdomain name.
After the terraform apply command is executed, Terraform will ask you to confirm the actions to be executed.
After confirming that everything is correct, enter yes . Then, wait for the command to complete.

©2013-2022 Tencent Cloud. All rights reserved.

Page 48 of 56

Tencent Cloud EdgeOne

PS tf-doc> terraform apply
tencentcloud_teo_zone.example: Refreshing state... [id=zone-2ag9gej58j36]
Terraform used the selected providers to generate the following execution plan. Res+ create
Terraform will perform the following actions:# tencentcloud_teo_dns_record.rule_record will be created+ resource "tencentcloud_teo_dns_record" "rule_record" {+ cname= (known after apply)+ content= "<your-backend-ip>"+ created_on= (known after apply)+ dns_record_id = (known after apply)©2013-2022 Tencent Cloud. All rights reserved.

Page 49 of 56

Tencent Cloud EdgeOne+ domain_status = (known after apply)+ id= (known after apply)+ locked= (known after apply)+ mode= "proxied"+ modified_on= (known after apply)+ name= "rule.example.com"+ priority+ status+ ttl+ type+ zone_id= (known after apply)= (known after apply)
= 300
= "A"
= "zone-2ag9gej58j36"}# tencentcloud_teo_rule_engine.rule_example will be created+ resource "tencentcloud_teo_rule_engine" "rule_example" {+ id= (known after apply)+ rule_id= (known after apply)+ rule_name = "example_rule"+ status= "enable"+ zone_id= "zone-2ag9gej58j36"+ rules {+ actions {+ normal_action {+ action = "CacheKey"+ parameters {+ name= "Type"+ values = [+ "IgnoreCase",]}+ parameters {+ name= "Switch"+ values = [+ "off",]}+ parameters {+ name= "Type"+ values = [+ "Header",]}+ parameters {+ name= "Switch"+ values = [+ "on",]}©2013-2022 Tencent Cloud. All rights reserved.

Page 50 of 56

Tencent Cloud EdgeOne+ parameters {+ name= "Value"+ values = [+ "User-Agent",]}}}+ actions {+ rewrite_action {+ action = "ResponseHeader"+ parameters {+ action = "add"+ name= "Added-Header"+ values = [+ "Added-Value",]}}}+ or {+ and {
+ operator = "equal"+ target= "host"+ values= [+ "rule.example.com",]}+ and {
+ operator = "equal"+ target= "extension"+ values= [+ "mp3",+ "mp4",]}}}}
Plan: 2 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
tencentcloud_teo_dns_record.rule_record: Creating...
tencentcloud_teo_dns_record.rule_record: Creation complete after 2s [id=zone-2ag9ge
tencentcloud_teo_rule_engine.rule_example: Creating...

©2013-2022 Tencent Cloud. All rights reserved.

Page 51 of 56

Tencent Cloud EdgeOne

tencentcloud_teo_rule_engine.rule_example: Creation complete after 1s [id=zone-2ag9
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
4. Check the command execution result.
You can run terraform show to check whether the rule engine configuration takes effect or log in to the
EdgeOne console for confirmation.

PS tf-doc> terraform state show tencentcloud_teo_dns_record.rule_record# tencentcloud_teo_dns_record.rule_record:
resource "tencentcloud_teo_dns_record" "rule_record" {content= "<your-backend-ip>"©2013-2022 Tencent Cloud. All rights reserved.

Page 52 of 56

Tencent Cloud EdgeOne

created_on= "2022-10-20T06:31:38Z"
dns_record_id = "record-2ahmb3w7ssl8"
domain_status = ["security",]id= "zone-2ag9gej58j36#record-2ahmb3w7ssl8"
lockedmode
modified_on
namepriority
statusttl
type
zone_id= false= "proxied"= "2022-10-20T06:31:38Z"= "rule.example.com"= 0= "active"
= 300
= "A"
= "zone-2ag9gej58j36"}
PS tf-doc> terraform state show tencentcloud_teo_rule_engine.rule_example# tencentcloud_teo_rule_engine.rule_example:
resource "tencentcloud_teo_rule_engine" "rule_example" {id= "zone-2ag9gej58j36#rule-2ahmb5dhn9qq"
rule_id= "rule-2ahmb5dhn9qq"
rule_name = "example_rule"
status= "enable"
zone_id= "zone-2ag9gej58j36"
rules {
actions {normal_action {action = "CacheKey"
parameters {name= "Type"values = ["IgnoreCase",]}parameters {name= "Switch"values = ["off",]}
parameters {name= "Type"values = ["Header",]}parameters {©2013-2022 Tencent Cloud. All rights reserved.

Page 53 of 56

Tencent Cloud EdgeOne

name= "Switch"values = [
"on",
]
}
parameters {name= "Value"
values = ["User-Agent",]}}}
actions {rewrite_action {action = "ResponseHeader"parameters {action = "add"name= "Added-Header"values = ["Added-Value",
]
}
}
}
or {
and {
operator = "equal"
target= "host"values= ["rule.example.com",
]
}
and {
operator = "equal"
target= "extension"values= ["mp3","mp4",]}}}}©2013-2022 Tencent Cloud. All rights reserved.

Page 54 of 56

Tencent Cloud EdgeOne

IP Location Query：

Last updated 2023-04-10 18:14:58
This document describes how to verify whether an IP is owned by EdgeOne and query the IP geolocation.

Directions
1. Log in to the EdgeOne console and click IP Location Query in the left sidebar.

2. On the IP Location Query page, enter the IPs to query (one per line). You can query up to 100 IP addresses at atime. IPv6 addresses are supported.
3. Click Search. The Query results table shows the IP geolocation and whether they are owned by EdgeOne nodes.
To export the query results, click the download iconin the top-right corner of the table. The query results are exported to a CSV file.

©2013-2022 Tencent Cloud. All rights reserved.

Page 55 of 56

Tencent Cloud EdgeOne©2013-2022 Tencent Cloud. All rights reserved.

Page 56 of 56