ALIYUN::FC3::CustomDomain

ALIYUN::FC3::CustomDomain类型用于函数计算 FC 3.0创建自定义域名。

语法

{
  "Type": "ALIYUN::FC3::CustomDomain",
  "Properties": {
    "AuthConfig": Map,
    "DomainName": String,
    "Protocol": String,
    "CertConfig": Map,
    "RouteConfig": Map,
    "TlsConfig": Map,
    "WafConfig": Map
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

AuthConfig

Map

权限认证配置。

更多信息,请参见AuthConfig属性

DomainName

String

域名。

填写已在阿里云备案或接入备案的自定义域名名称。

Protocol

String

域名支持的协议类型。

取值:

  • HTTP:仅支持 HTTP 协议

  • HTTPS:仅支持 HTTPS 协议。

  • HTTP,HTTPS:支持 HTTP 及 HTTPS 协议。

CertConfig

Map

HTTPS 证书的信息。

更多信息,请参见CertConfig属性

RouteConfig

Map

路由表。

自定义域名访问时的 PATH 到 Function 的映射。更多信息,请参见RouteConfig属性

TlsConfig

Map

TLS 配置信息。

更多信息,请参见TlsConfig属性

WafConfig

Map

Web 应用防火墙配置信息。

更多信息,请参见WafConfig属性

CertConfig语法

"CertConfig": {
  "PrivateKey": String,
  "CertName": String,
  "Certificate": String
}

CertConfig属性

属性名称

类型

必须

允许更新

描述

约束

CertName

String

证书名称。

Certificate

String

PEM 格式证书。

PrivateKey

String

PEM 格式私钥。

TlsConfig语法

"TlsConfig": {
  "MinVersion": String,
  "MaxVersion": String,
  "CipherSuites": List
}

TlsConfig属性

属性名称

类型

必须

允许更新

描述

约束

CipherSuites

List

TLS 加密套件列表。

最多支持配置100个加密套件。

MinVersion

String

TLS 最小版本号。

枚举值:

  • TLSv1.3

  • TLSv1.2

MaxVersion

String

TLS 最大版本号。

枚举值:

  • TLSv1.3

  • TLSv1.2

RouteConfig语法

"RouteConfig": {
  "Routes": List
}

RouteConfig属性

属性名称

类型

必须

允许更新

描述

约束

Routes

List

路由配置列表。

最多支持配置100个路由配置。更多信息,请参见Routes属性

Routes语法

"Routes": [
  {
    "Path": String,
    "FunctionName": String,
    "Qualifier": String,
    "RewriteConfig": Map,
    "Methods": List
  }
]

Routes属性

属性名称

类型

必须

允许更新

描述

约束

FunctionName

String

函数名。

Path

String

路由匹配规则。

Qualifier

String

版本或者别名。

Methods

List

支持的方法。

取值:

  • HEAD

  • GET

  • POST

  • PUT

  • DELETE

  • PATCH

  • OPTIONS

RewriteConfig

Map

重写配置。

更多信息,请参见RewriteConfig属性

RewriteConfig语法

"RewriteConfig": {
  "WildcardRules": List,
  "RegexRules": List,
  "EqualRules": List
}

RewriteConfig属性

属性名称

类型

必须

允许更新

描述

约束

EqualRules

List

精确匹配规则列表。

最多支持配置100个规则。更多信息,请参见EqualRules属性

RegexRules

List

正则匹配规则列表。

最多支持配置100个规则。更多信息,请参见RegexRules属性

WildcardRules

List

通配匹配规则列表。

最多支持配置100个规则。更多信息,请参见WildcardRules属性

WildcardRules语法

"WildcardRules": [
  {
    "Replacement": String,
    "Match": String
  }
]

WildcardRules属性

属性名称

类型

必须

允许更新

描述

约束

Match

String

匹配规则。

Replacement

String

替换规则。

RegexRules语法

"RegexRules": [
  {
    "Replacement": String,
    "Match": String
  }
]

RegexRules属性

属性名称

类型

必须

允许更新

描述

约束

Match

String

匹配规则。

Replacement

String

替换规则。

EqualRules语法

"EqualRules": [
  {
    "Replacement": String,
    "Match": String
  }
]

EqualRules属性

属性名称

类型

必须

允许更新

描述

约束

Match

String

匹配规则。

Replacement

String

替换规则。

AuthConfig语法

"AuthConfig": {
  "AuthInfo": String,
  "AuthType": String
}

AuthConfig属性

属性名称

类型

必须

允许更新

描述

约束

AuthType

String

认证类型。

取值:

  • anonymous

  • function

  • jwt

AuthInfo

String

认证信息。

WafConfig语法

"WafConfig": {
  "EnableWAF": Boolean
}

WafConfig属性

属性名称

类型

必须

允许更新

描述

约束

EnableWAF

Boolean

是否开启 WAF 防护。

返回值

Fn::GetAtt

DomainName:域名。

示例

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  DomainName:
    Type: String
    Description:
      en: Domain name. Fill in the custom domain name that has been filed in Ali cloud or access to the record.
    Required: true
  AuthConfig:
    AssociationPropertyMetadata:
      Parameters:
        AuthInfo:
          Type: String
          Description:
            en: Authentication information.
          Required: false
        AuthType:
          Type: String
          Description:
            en: Authentication type.
          AllowedValues:
            - anonymous
            - function
            - jwt
          Required: true
    Type: Json
    Description:
      en: Permission authentication configuration.
    Required: true
  Protocol:
    Type: String
    Description:
      en: |-
        Protocol types supported by the domain name. Valid values:
        - HTTP: Only HTTP protocol is supported. 
        - HTTPS: HTTPS only is supported. 
        - HTTP,HTTPS: Supports HTTP and HTTPS protocols.
    AllowedValues:
      - HTTP
      - HTTPS
      - HTTP,HTTPS
    Required: true
Resources:
  CustomDomain:
    Type: ALIYUN::FC3::CustomDomain
    Properties:
      DomainName:
        Ref: DomainName
      AuthConfig:
        Ref: AuthConfig
      Protocol:
        Ref: Protocol
Outputs:
  DomainName:
    Description: The domain name
    Value:
      Fn::GetAtt:
        - CustomDomain
        - DomainName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "DomainName": {
      "Type": "String",
      "Description": {
        "en": "Domain name. Fill in the custom domain name that has been filed in Ali cloud or access to the record."
      },
      "Required": true
    },
    "AuthConfig": {
      "AssociationPropertyMetadata": {
        "Parameters": {
          "AuthInfo": {
            "Type": "String",
            "Description": {
              "en": "Authentication information."
            },
            "Required": false
          },
          "AuthType": {
            "Type": "String",
            "Description": {
              "en": "Authentication type."
            },
            "AllowedValues": [
              "anonymous",
              "function",
              "jwt"
            ],
            "Required": true
          }
        }
      },
      "Type": "Json",
      "Description": {
        "en": "Permission authentication configuration."
      },
      "Required": true
    },
    "Protocol": {
      "Type": "String",
      "Description": {
        "en": "Protocol types supported by the domain name. Valid values:\n- HTTP: Only HTTP protocol is supported. \n- HTTPS: HTTPS only is supported. \n- HTTP,HTTPS: Supports HTTP and HTTPS protocols."
      },
      "AllowedValues": [
        "HTTP",
        "HTTPS",
        "HTTP,HTTPS"
      ],
      "Required": true
    }
  },
  "Resources": {
    "CustomDomain": {
      "Type": "ALIYUN::FC3::CustomDomain",
      "Properties": {
        "DomainName": {
          "Ref": "DomainName"
        },
        "AuthConfig": {
          "Ref": "AuthConfig"
        },
        "Protocol": {
          "Ref": "Protocol"
        }
      }
    }
  },
  "Outputs": {
    "DomainName": {
      "Description": "The domain name",
      "Value": {
        "Fn::GetAtt": [
          "CustomDomain",
          "DomainName"
        ]
      }
    }
  }
}