tencent cloud

文档反馈

AutoRewrite

最后更新时间:2024-09-05 19:28:15

    1. API Description

    Domain name for API request: clb.tencentcloudapi.com.

    An HTTPS:443 listener needs to be created first, along with a forwarding rule. When this API is called, an HTTP:80 listener will be created automatically if it did not exist and a forwarding rule corresponding to Domains (specified in the input parameter) under the HTTPS:443 listener will also be created. After successful creation, access requests to an HTTP:80 address will be redirected to an HTTPS:443 address automatically.

    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: AutoRewrite.
    Version Yes String Common Params. The value used for this API: 2018-03-17.
    Region No String Common Params. This parameter is not required for this API.
    LoadBalancerId Yes String CLB instance ID
    ListenerId Yes String HTTPS:443 listener ID
    Domains.N No Array of String The domain name to be redirected under the listener HTTPS:443. If it is left empty, all domain names under the listener HTTPS:443 will be configured with redirects.
    RewriteCodes.N No Array of Integer Redirection status code. Valid values: 301, 302, and 307.
    TakeUrls.N No Array of Boolean Whether the matched URL is carried in redirection.

    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 Automatically generating a redirection relationship

    lbl-lmeeyb1q is an HTTPS:443 listener. www.abc.com is a domain name of a forwarding rule under this listener.

    Input Example

    https://clb.tencentcloudapi.com/?Action=AutoRewrite
    &LoadBalancerId=lb-r6nx1iby
    &ListenerId=lbl-lmeeyb1q
    &Domains.0=www.abc.com
    &<Common request parameters>
    

    Output Example

    {
        "Response": {
            "RequestId": "e351bfdb-147a-4648-b9fe-bbcacff68789"
        }
    }
    

    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
    FailedOperation Operation failed.
    FailedOperation.InvalidLBStatus Exceptional CLB instance status
    InternalError Internal error.
    InvalidParameter Parameter error.
    InvalidParameter.FormatError Wrong parameter format.
    InvalidParameter.LBIdNotFound Wrong CLB instance ID.
    InvalidParameter.ListenerIdNotFound Wrong listener ID.
    InvalidParameter.LocationNotFound Unable to find eligible forwarding rules.
    InvalidParameter.PortCheckFailed Listener port checks failed due to port conflicts or other reasons.
    InvalidParameter.ProtocolCheckFailed Listener protocol checks failed because the protocol used is incompatible with the corresponding operation.
    InvalidParameter.RewriteAlreadyExist The forwarding rule has already been bound to a redirection relationship.
    InvalidParameterValue Incorrect parameter value.
    InvalidParameterValue.Length Wrong parameter length.
    LimitExceeded Quota exceeded.
    ResourceInsufficient Insufficient resources.
    UnauthorizedOperation Unauthorized operation.