All Products
Search
Document Center

Function Compute:CreateCustomDomain

Last Updated:Aug 14, 2023

Creates a custom domain name.

Request headers

This operation uses only common request headers and does not have operation-specific request headers. For more information, see Common request parameters.

Request syntax

POST /custom-domains HTTP/1.1

Request parameters

Parameter Type Position Required Example Description
Object Body Yes

The definition of the domain name.

certConfig CertConfig Body No

The configuration of the certificate used for HTTPS.

domainName String Body Yes example.com

The custom domain name that has obtained the ICP filing in the Alibaba Cloud ICP Filing system or whose ICP filing information includes Alibaba Cloud as a service provider.

protocol String Body No HTTP

The protocol type that is supported by the custom domain name. Valid values:

  • HTTP
  • HTTP,HTTPS
routeConfig RouteConfig Body No

The route table that maps paths to functions when the functions are invoked by using the custom domain name.

Response parameters

Parameter Type Example Description
accountId String 1986114****4305

The account ID.

apiVersion String 2016-08-15

The version of the API.

certConfig CertConfig

The configurations of the HTTPS certificate.

createdTime String 2020-07-27T08:02:19Z

The time when the domain name was created.

domainName String example.com

The custom domain name that has obtained the ICP filing in the Alibaba Cloud ICP Filing system or whose ICP filing information includes Alibaba Cloud as a service provider.

lastModifiedTime String 2020-07-27T08:02:19Z

The last time when the domain name was updated.

protocol String HTTP

The protocol type that is supported by the custom domain name. Valid values:

  • HTTP
  • HTTP,HTTPS
routeConfig RouteConfig

The route table that maps paths to functions when the functions are invoked by using the custom domain name.

Examples

Sample requests

POST /custom-domains HTTP/1.1
Host:fc-ram.aliyuncs.com
Content-Type:application/json

{
  "certConfig" : {
    "certificate" : "-----BEGIN CERTIFICATE----- xxxxx -----END CERTIFICATE-----",
    "privateKey" : "-----BEGIN RSA PRIVATE KEY----- xxxxx -----END RSA PRIVATE KEY-----"
  },
  "domainName" : "example.com",
  "protocol" : "HTTP",
  "routeConfig" : {
    "routes" : [ {
      "functionName" : "f1",
      "methods" : [ "GET" ],
      "path" : "/login",
      "qualifier" : "prod",
      "serviceName" : "s1"
    } ]
  }
}

Sample success response

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "accountId" : "1986114****4305",
  "apiVersion" : "2016-08-15",
  "certConfig" : {
    "certificate" : "-----BEGIN CERTIFICATE----- xxxxx -----END CERTIFICATE-----",
    "privateKey" : "-----BEGIN RSA PRIVATE KEY----- xxxxx -----END RSA PRIVATE KEY-----"
  },
  "createdTime" : "2020-07-27T08:02:19Z",
  "domainName" : "example.com",
  "lastModifiedTime" : "2020-07-27T08:02:19Z",
  "protocol" : "HTTP",
  "routeConfig" : {
    "routes" : [ {
      "functionName" : "f1",
      "methods" : [ "GET" ],
      "path" : "/login",
      "qualifier" : "prod",
      "serviceName" : "s1"
    } ]
  }
}