tencent cloud

All product documents
Tencent Cloud EdgeOne
ModifyL7AccRule
Last updated: 2025-02-19 19:34:16
ModifyL7AccRule
Last updated: 2025-02-19 19:34:16

1. API Description

Domain name for API request: teo.intl.tencentcloudapi.com.

This API is used to modify rules in the rule engine, supporting only one rule modification per request.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: ModifyL7AccRule.
Version Yes String Common Params. The value used for this API: 2022-09-01.
Region No String Common Params. This parameter is not required.
ZoneId Yes String Zone id.
Rule Yes RuleEngineItem Rules to be modified. you can first obtain the ruleid of the rule to be modified through the describel7accrules api, then pass in the modified rule content. the original rule content will be updated in an overriding manner.

3. Output Parameters

Parameter Name Type Description
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Modifying Rules

Modify the content of a single rule in the rule engine.

Input Example

POST / HTTP/1.1
Host: teo.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyL7AccRule
<Common request parameters>

{
    "ZoneId": "zone-27q0p0bali12",
    "Rule": {
        "RuleId": "rule-djuq23",
        "RuleName": "Test Rule",
        "Status": "disable",
        "Description": [
            "Note 1",
            Annotation 2
        ],
        "Branches": [
            {
                "Condition": "${http.request.host} in ['www.example.com']",
                "Actions": [
                    {
                        "Name": "ModifyOrigin",
                        "ModifyOriginParameters": {
                            "OriginType": "IPDomain",
                            "Origin": "1.1.1.1",
                            "OriginProtocol": "follow",
                            "HTTPOriginPort": 80,
                            "HTTPSOriginPort": 443
                        }
                    }
                ],
                "SubRules": [
                    {
                        "Description": [
                            Node Cache TTL Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "Cache",
                                        "CacheParameters": {
                                            "FollowOrigin": {
                                                "Switch": "on",
                                                "DefaultCache": "on",
                                                "DefaultCacheStrategy": "on",
                                                "DefaultCacheTime": 0
                                            }
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            Browser Cache TTL Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "MaxAge",
                                        "MaxAgeParameters": {
                                            "FollowOrigin": "off",
                                            "CacheTime": 0
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            Custom `CacheKey` Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "CacheKey",
                                        "CacheKeyParameters": {
                                            "FullURLCache": "off",
                                            "QueryString": {
                                                "Switch": "on",
                                                "Action": "includeCustom",
                                                "Values": [
                                                    "name1",
                                                    "name2"
                                                ]
                                            },
                                            "IgnoreCase": "on",
                                            "Header": {
                                                "Switch": "on",
                                                "Values": [
                                                    "EO-Client-Device",
                                                    "EO-Client-OS"
                                                ]
                                            },
                                            "Scheme": "on",
                                            "Cookie": {
                                                "Switch": "off"
                                            }
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            Status Code Cache TTL Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "StatusCodeCache",
                                        "StatusCodeCacheParameters": {
                                            "StatusCodeCacheParams": [
                                                {
                                                    "StatusCode": 400,
                                                    "CacheTime": 4
                                                },
                                                {
                                                    "StatusCode": 401,
                                                    "CacheTime": 180
                                                },
                                                {
                                                    "StatusCode": 403,
                                                    "CacheTime": 7200
                                                },
                                                {
                                                    "StatusCode": 404,
                                                    "CacheTime": 86400
                                                }
                                            ]
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            Cache Prefresh Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "CachePrefresh",
                                        "CachePrefreshParameters": {
                                            "Switch": "on",
                                            "CacheTimePercent": 80
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            Offline Cache Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "OfflineCache",
                                        "OfflineCacheParameters": {
                                            "Switch": "on"
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            HTTP2 Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "HTTP2",
                                        "HTTP2Parameters": {
                                            "Switch": "on"
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            QUIC Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "QUIC",
                                        "QUICParameters": {
                                            "Switch": "on"
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            WebSocket Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "WebSocket",
                                        "WebSocketParameters": {
                                            "Switch": "on",
                                            "Timeout": 30
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            Maximum Upload Size Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "PostMaxSize",
                                        "PostMaxSizeParameters": {
                                            "Switch": "on",
                                            "MaxSize": 524288000
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            Smart Compression Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "Compression",
                                        "CompressionParameters": {
                                            "Switch": "on",
                                            "Algorithms": [
                                                "gzip"
                                            ]
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            Intelligent Acceleration Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "SmartRouting",
                                        "SmartRoutingParameters": {
                                            "Switch": "on"
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            HTTP/2 Origin-Pull Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "UpstreamHTTP2",
                                        "UpstreamHTTP2Parameters": {
                                            "Switch": "off"
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            Origin-Pull Timeout Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "HTTPUpstreamTimeout",
                                        "HTTPUpstreamTimeoutParameters": {
                                            "ResponseTimeout": 15
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            Forced HTTPS Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "ForceRedirectHTTPS",
                                        "ForceRedirectHTTPSParameters": {
                                            "Switch": "on",
                                            "RedirectStatusCode": 302
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            HSTS Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "HSTS",
                                        "HSTSParameters": {
                                            "Switch": "on",
                                            "Timeout": 1000,
                                            "IncludeSubDomains": "on",
                                            "Preload": "on"
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            SSL/TLS Security Configuration Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "TLSConfig",
                                        "TLSConfigParameters": {
                                            "Version": [
                                                "TLSv1",
                                                "TLSv1.1",
                                                "TLSv1.2",
                                                "TLSv1.3"
                                            ],
                                            "CipherSuite": "loose-v2023"
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            OCSP Stapling Example
                            Following Origin Redirects Example
                            Example of redirection during origin pull
                            Custom error page example
                            Range GETs example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "OCSPStapling",
                                        "OCSPStaplingParameters": {
                                            "Switch": "on"
                                        }
                                    },
                                    {
                                        "Name": "UpstreamRequest",
                                        "UpstreamRequestParameters": {
                                            "QueryString": {
                                                "Switch": "on",
                                                "Action": "includeCustom",
                                                "Values": [
                                                    "name1",
                                                    "name2"
                                                ]
                                            },
                                            "Cookie": {
                                                "Switch": "on",
                                                "Action": "full"
                                            }
                                        }
                                    },
                                    {
                                        "Name": "UpstreamFollowRedirect",
                                        "UpstreamFollowRedirectParameters": {
                                            "Switch": "on",
                                            "MaxTimes": 3
                                        }
                                    },
                                    {
                                        "Name": "ErrorPage",
                                        "ErrorPageParameters": {
                                            "ErrorPageParams": [
                                                {
                                                    "StatusCode": 400,
                                                    "RedirectURL": "http://www.test-v.com/custom-page.html"
                                                },
                                                {
                                                    "StatusCode": 403,
                                                    "RedirectURL": "http://www.test-v.com/custom-page1.html"
                                                }
                                            ]
                                        }
                                    },
                                    {
                                        "Name": "RangeOriginPull",
                                        "RangeOriginPullParameters": {
                                            "Switch": "on"
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            "Example of origin HTTPS"
                            Example of Modifying HTTP Request Headers
                            Host Header Rewrite Example
                            Access URL Redirection Example
                            Token Authentication Example
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "OriginPullProtocol"
                                    },
                                    {
                                        "Name": "ModifyRequestHeader",
                                        "ModifyRequestHeaderParameters": {
                                            "HeaderActions": [
                                                {
                                                    "Action": "add",
                                                    "Name": "EO-Client-Browser"
                                                },
                                                {
                                                    "Action": "del",
                                                    "Name": "EO-Client-Device"
                                                },
                                                {
                                                    "Action": "set",
                                                    "Name": "EO-Client-OS"
                                                }
                                            ]
                                        }
                                    },
                                    {
                                        "Name": "HostHeader",
                                        "HostHeaderParameters": {
                                            "Action": "followOrigin"
                                        }
                                    },
                                    {
                                        "Name": "AccessURLRedirect",
                                        "AccessURLRedirectParameters": {
                                            "StatusCode": 302,
                                            "Protocol": "follow",
                                            "HostName": {
                                                "Action": "follow"
                                            },
                                            "URLPath": {
                                                "Action": "follow"
                                            },
                                            "QueryString": {
                                                "Action": "full"
                                            }
                                        }
                                    },
                                    {
                                        "Name": "Authentication",
                                        "AuthenticationParameters": {
                                            "AuthType": "TypeA",
                                            "Timeout": 5,
                                            "SecretKey": "BCChgIM4o0k08Uk0Jgi3f27ir3",
                                            "BackupSecretKey": "3deJ7O6CsqlIk",
                                            "AuthParam": "test123QQ"
                                        }
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "Description": [
                            Modifying HTTP Node Response Headers Sample
                            Client IP Header Sample
                            Client IP Geographical Location Header Sample
                            HTTP Response Sample
                            Access URL Redirection Sample
                        ],
                        "Branches": [
                            {
                                "Condition": "${http.request.host} in ['www.example.com']",
                                "Actions": [
                                    {
                                        "Name": "ModifyResponseHeader",
                                        "ModifyResponseHeaderParameters": {
                                            "HeaderActions": [
                                                {
                                                    "Action": "add",
                                                    "Name": "Access-Control-Allow-Methods",
                                                    "Value": "POST,GET"
                                                },
                                                {
                                                    "Action": "set",
                                                    "Name": "Access-Control-Allow-Origin",
                                                    "Value": "http://test.com,http://1.1.1.1"
                                                },
                                                {
                                                    "Action": "del",
                                                    "Name": "Content-Disposition"
                                                }
                                            ]
                                        }
                                    },
                                    {
                                        "Name": "ClientIPHeader",
                                        "ClientIPHeaderParameters": {
                                            "Switch": "on",
                                            "HeaderName": "test"
                                        }
                                    },
                                    {
                                        "Name": "ClientIPCountry",
                                        "ClientIPCountryParameters": {
                                            "Switch": "on",
                                            "HeaderName": "EO-Client-IPCountry"
                                        }
                                    },
                                    {
                                        "Name": "HttpResponse",
                                        "HttpResponseParameters": {
                                            "StatusCode": 400,
                                            "ResponsePage": "p-30tcxgl8i0ls"
                                        }
                                    },
                                    {
                                        "Name": "UpstreamURLRewrite",
                                        "UpstreamURLRewriteParameters": {
                                            "Type": "Path",
                                            "Action": "addPrefix",
                                            "Value": "/prefix"
                                        }
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    }
}

Output Example

{
    "Response": {
        "RequestId": "811d2583-310c-41f4-b5e7-abe407404sxsd"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InternalError.ConfigLocked The configuration is locked. Please unlock and try again.
InternalError.SystemError Internal system error.
InvalidParameter.CacheKeyQueryStringTooManyValue The query string has too many values.
InvalidParameter.CertSystemError Internal error.
InvalidParameter.CompressionInvalidAlgorithms Invalid compression algorithm.
InvalidParameter.ErrActionUnsupportTarget The current conditions do not support the requested operation.
InvalidParameter.ErrInvalidAction Invalid operation.
InvalidParameter.ErrInvalidActionDuplicateAction Invalid operation: Duplicate operation configuration.
InvalidParameter.ErrInvalidActionParam Invalid operation: Invalid parameter.
InvalidParameter.ErrInvalidActionParamAction Invalid parameter "action".
InvalidParameter.ErrInvalidActionParamDuplicateName Invalid parameter: Duplicate parameter names.
InvalidParameter.ErrInvalidActionParamName Invalid value type for the parameter "action".
InvalidParameter.ErrInvalidActionParamTooManyValues Invalid parameter: The parameter has too many values.
InvalidParameter.ErrInvalidActionParamValue Invalid action.
InvalidParameter.ErrInvalidActionType Invalid action type.
InvalidParameter.ErrInvalidConditionHostTooManyWhenModifyOriginActionConfigured You can only configure one host matching type when modifying the origin.
InvalidParameter.ErrInvalidConditionIgnoreCase Invalid condition: The letter case is ignored.
InvalidParameter.ErrInvalidConditionNameBadName Invalid condition: Invalid parameter name.
InvalidParameter.ErrInvalidConditionNameTargetNotSupportName Invalid condition: The match type is not supported by this parameter.
InvalidParameter.ErrInvalidConditionValueBadRegular Invalid condition: Invalid regular expression for the parameter value.
InvalidParameter.ErrInvalidConditionValueBadUrl Invalid parameter value "url".
InvalidParameter.ErrInvalidConditionValueBadValue Invalid condition: The parameter value is invalid.
InvalidParameter.ErrInvalidConditionValueBadValueContainFileNameExtension Invalid parameter value: File extension is not allowed.
InvalidParameter.ErrInvalidConditionValueTooLongValue Invalid condition: The parameter value exceeds the limit.
InvalidParameter.ErrInvalidConditionValueTooManyValues Invalid condition: The parameter value exceeds the limit.
InvalidParameter.ErrInvalidConditionValueTooManyWildcard Invalid condition: Too many wildcards in the parameter.
InvalidParameter.ErrInvalidElseWhenModifyOriginActionConfigured ELSE is not supported for origin server modification.
InvalidParameter.ErrNilCondition Empty condition.
InvalidParameter.GrpcRequireHttp2 To enable gRPC support, HTTP/2 support must be enabled as well.
InvalidParameter.HostNotFound The domain name does not exist.
InvalidParameter.InvalidAuthenticationTypeSecretKey Invalid key for token authentication.
InvalidParameter.InvalidAuthenticationTypeSignParam Invalid token authentication parameter.
InvalidParameter.InvalidAuthenticationTypeTimeFormat Invalid authentication token format.
InvalidParameter.InvalidAuthenticationTypeTimeParam Invalid authentication token parameter.
InvalidParameter.InvalidAwsRegion Invalid region. Please fill in a correct region of the third-party object storage service.
InvalidParameter.InvalidBackupServerName Invalid secondary origin domain.
InvalidParameter.InvalidCacheKey Invalid cache key.
InvalidParameter.InvalidCacheKeyCookie Invalid cache key cookie.
InvalidParameter.InvalidCacheKeyIgnoreCase Cases are ignored in the cache key.
InvalidParameter.InvalidCacheKeyScheme Invalid cache key scheme.
InvalidParameter.InvalidCacheTime Invalid node cache validity.
InvalidParameter.InvalidClientIpHeaderName Invalid client IP request header.
InvalidParameter.InvalidCosDomain Invalid origin-pull configuration. When OriginType is COS or AWS_S3, the origin address must be an object storage domain name.
InvalidParameter.InvalidErrorPageRedirectUrl Invalid custom error page.
InvalidParameter.InvalidHttpsCipherSuiteAndTlsVersion The cipher suite does not match the TLS version.
InvalidParameter.InvalidHttpsHstsMaxAge Invalid HTTPS HSTS.
InvalidParameter.InvalidIpv6Switch Invalid IPv6 settings.
InvalidParameter.InvalidMaxAgeTime Invalid browser cache.
InvalidParameter.InvalidOrigin Invalid origin server.
InvalidParameter.InvalidParameter Invalid parameter.
InvalidParameter.InvalidRangeOriginPull Invalid Range GETs.
InvalidParameter.InvalidRequestHeaderName Invalid request header.
InvalidParameter.InvalidRequestHeaderNameXff Invalid request header x-forwarded-for.
InvalidParameter.InvalidRequestHeaderValue Invalid request header.
InvalidParameter.InvalidResponseHeaderName Invalid response header.
InvalidParameter.InvalidResponseHeaderValue Invalid response header.
InvalidParameter.InvalidRuleEngineAction Invalid rule engine operation.
InvalidParameter.InvalidRuleEngineNotFound The rule does not exist.
InvalidParameter.InvalidRuleEngineTarget Invalid rule engine condition.
InvalidParameter.InvalidRuleEngineTargetsExtension Invalid file extension in the rule engine condition.
InvalidParameter.InvalidRuleEngineTargetsUrl Invalid URL in the rule engine condition.
InvalidParameter.InvalidServerName Invalid origin domain.
InvalidParameter.InvalidUpstreamRequestQueryStringValue Origin-pull request configuration error: Invalid query string.
InvalidParameter.InvalidUrlRedirectHost Invalid target host in the URL rewriting rule.
InvalidParameter.InvalidUrlRedirectUrl The target URL for URL rewrite is invalid.
InvalidParameter.KeyRulesInvalidQueryStringValue Invalid cache key.
InvalidParameter.LoadBalanceInstanceIdIsRequired The Cloud Load Balancer instance ID is required in the operation of modifying the origin server.
InvalidParameter.NotSupportThisPreset Unsupported preset variables exist.
InvalidParameter.OriginOriginGroupIdIsRequired The origin group ID is required.
InvalidParameter.OriginPullProtocolIsRequired The return protocol is required in the operation of modifying the origin server.
InvalidParameter.PostMaxSizeLimitExceeded Maximum upload size exceeded.
InvalidParameter.ResponseHeaderCacheControlNotAllowDelete Invalid response header.
InvalidParameter.StatusCodeCacheInvalidStatusCode Invalid status code in cache.
InvalidParameter.TlsVersionNotInSequence TLS version is not continuous for HTTPS.
InvalidParameterValue.FormatMismatch Format mismatch.
InvalidParameterValue.GeneralMismatch Configuration parameter format mismatch.
InvalidParameterValue.IncludeInvalidValue Contains invalid value.
InvalidParameterValue.MissingNecessaryParam Missing required configuration parameters.
InvalidParameterValue.NotInEnumeration The value is not within the required collection.
InvalidParameterValue.NotWithinRange The value is not within the specified range.
InvalidParameterValue.RegExMismatch Does not match the specified regular expression.
InvalidParameterValue.TrialPlanResponsePage Referencing is not allowed on the custom page of the trial plan.
InvalidParameterValue.UnrecognizableValue Configuration item error.
LimitExceeded The quota limit has been reached.
OperationDenied Operation denied.
OperationDenied.ConfigLocked The configuration is locked. Please unlock and try again.
OperationDenied.ErrZoneIsAlreadyPaused The EdgeOne service of the site is disabled. Please enable it and try again.
OperationDenied.InvalidAdvancedDefenseSecurityType The security service must be enabled when you enable the DDoS Protection.
ResourceInUse The resource is occupied.
UnauthorizedOperation.CamUnauthorized CAM is not authorized.
UnauthorizedOperation.Unknown An unknown error occurred in the backend server.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support