All Products
Search
Document Center

Function Compute:CreateCustomDomain

Last Updated:Oct 08, 2024

Creates a custom domain name.

Operation description

If you want to use a fixed domain name to access an application or function in a production environment of Function Compute, or to resolve the issue of forced downloads when accessing an HTTP trigger, you can bind a custom domain name to the application or function.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request syntax

POST /2023-03-30/custom-domains HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
bodyCreateCustomDomainInputYes

The information about the custom domain name.

Response parameters

ParameterTypeDescriptionExample
CustomDomain

The information about the custom domain name.

Examples

Sample success responses

JSONformat

{
  "accountId": "",
  "apiVersion": "2023-03-30",
  "authConfig": {
    "authInfo": "{}",
    "authType": "anonymous, function, jwt"
  },
  "certConfig": {
    "certName": "my-cert",
    "certificate": "PEM format",
    "privateKey": "PEM format"
  },
  "createdTime": "2023-03-30T08:02:19Z",
  "domainName": "example.com",
  "lastModifiedTime": "2023-03-30T08:02:19Z",
  "protocol": "HTTP",
  "routeConfig": {
    "routes": [
      {
        "functionName": "myFunction",
        "methods": [
          "GET"
        ],
        "path": "/api/*",
        "qualifier": "myAlias",
        "rewriteConfig": {
          "equalRules": [
            {
              "match": "/old",
              "replacement": "/new"
            }
          ],
          "regexRules": [
            {
              "match": "^/api/.+?/(.*)",
              "replacement": "/api/v2/$1"
            }
          ],
          "wildcardRules": [
            {
              "match": "/api/*",
              "replacement": "/$1"
            }
          ]
        }
      }
    ]
  },
  "subdomainCount": "1",
  "tlsConfig": {
    "cipherSuites": [
      "TLS_RSA_WITH_RC4_128_SHA"
    ],
    "maxVersion": "TLSv1.3",
    "minVersion": "TLSv1.0"
  },
  "wafConfig": {
    "enableWAF": true
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-06-14The API operation is not deprecated.View Change Details
2024-02-22The internal configuration of the API is changed, but the call is not affectedView Change Details
2023-08-30API Description UpdateView Change Details
2023-08-30API Description Update. The response structure of the API has changedView Change Details
2023-07-05The request parameters of the API has changedView Change Details
2023-06-28Add OperationView Change Details