4. AppProfile 专案相关 API 配置
URL: https://api-client.apeirocdn.com/api/v1
1. resources.appProfiles.list 呈现当前的专案列表
Method : GET
① 示范 (curl 模式)
curl --location 'https://api-client.apeirocdn.com/api/v1/resources/app-profiles?groupName=cdn-xxx&from=0&size=10&filters=servername:example.com' \
--header 'Cookie: access_token=my-token' \Parameter :
groupName
required
string
groupName=cdn-xxx
项目的群组名称
from
integer
from=0
从第 n 笔开始。预设:0。
size
integer
size=10
回传资料笔数。预设:10。
filters
string
Default: " "
filters=itemName:my_name
filters=appProfileDomainsLength Example: filters=servername:example.com filters=appProfileDomainsLength:2
用于检索项目的过滤器。
使用 +AND 来分隔过滤特征
使用 * 作为通配符
itemName=栏位名称 my_name=该栏位后面的 value
appProfile 当前域名使用量:appProfileDomainsLength
可以透过 appProfileDomainsLength 查看当前专案中域名使用量,例如:appProfileDomainsLength:2 即为过滤专案内只有两个域名的 Profile
2. resources.appProfiles.create 添加专案
Method : POST
① 示范 (curl 模式)
curl --location --request POST 'https://api-client.apeirocdn.com/api/v1/resources/app-profiles?groupName=cdn-xxx' \
--header 'content-type: application/json' \
--header 'Cookie: access_token=my-token' \
--data '{"appProfileName":"example.profiles","serviceGroupName":"cdn-xxx-a01-ws","origins":["1.1.1.1","www.example.com"]}'Parameter :
groupName
required
string
groupName=cdn-xxx
项目的群组名称
Body :
description
string
Default: ""
注解字段
tags
Array of strings
unique
Default: [""]
标签内容
appProfileName
string
<= 35 characters
^[a-z0-9-_.]*$
Default: "none"
指定 profile 名称,参见 resources.app-profiles.list
serviceGroupName
required if appProfileName is none
string
Example: "cdn-xxx-a01-ws"
指定 servicegroup,参见 resources.servicegroups.list。当 appProfileName 为空值时为必填 body 值。
useOriginPolicy
boolean
Default: false
是否使用回源策略
usedOriginPolicies
Array of objects
unique
Default: [] Example: {"regionName": ["default"],"originPolicyName": "testoriginpolicy"}
填写回源策略名称,仅在 useOriginPolicy:true 时生效。regionName 可填写国家代码,如 China=CN、Hongkong=HK,default 为必填项。
origins
required if appProfileName is none
Array of strings
>= 0 items unique
Example: ["1.1.1.1","www.example.com"]
填写回源目标,支持公网 IP 和完全域名,仅在 useOriginPolicy:false 时生效。当 appProfileName 为空值时为必填 body 值。
originscheme
string
Default: "http" Enum: "http" "https"
该域名的来源协议
portMappingType
string
Default: "default" Enum: "default" "static"
该域名的端口映射类型
originPort
integer
Default: 80
该域名的来源端口
scheme
Array of strings
non-empty unique
Default: "http" "https" Enum: "http" "https"
该域支持的访问模式
isUseOwasp
boolean
Default: false
使用 OWASP 开关
owaspRuleName
required if isUseOwasp is true
string
Example: "sys_default"
OWASP 规则,当 isUseOwasp 为 true 时必填
httpPort
Array of integers
non-empty unique
Default: [80]
http 监听端口。 可选范围 80, 8080, 8880, 2052, 2082, 2086, 2095。
httpsPort
Array of integers
non-empty unique
Default: [443]
https 监听端口。 可选范围 443 及 1001-4999、6001-32767,httpPort 和 9600 除外。
rewriteUrlRules
Array of objects
Example: See below
改写回源 URL 的规则集合
rewriteUrlRules[].description
string
Default: ""
描述此改写规则的用途
rewriteUrlRules[].isRewriteUrlPath
boolean
Default: false
是否启用路径改写
rewriteUrlRules[].sourcePath
string
Default: ""
改写目标路径
rewriteUrlRules[].destPath
string
Default: ""
替换路径
rewriteUrlRules[].isReplaceAll
boolean
Default: false
是否开启全部替换
rewriteUrlRules[].isIteration
boolean
Default: false
是否开启迭代
rewriteUrlRules[].isRewriteUrlArgs
boolean
Default: false
是否启用 args 改写
rewriteUrlRules[].rewriteUrlArgsRules
Array of objects
Default: []
改写 args 的规则集合
rewriteUrlRules[].rewriteUrlArgsRules[].sourceArgs
string
Default: ""
改写目标 args
rewriteUrlRules[].rewriteUrlArgsRules[].destArgs
string
Default: ""
替换 args
rewriteUrlRules[].rewriteUrlArgsRules[].isReplaceAll
boolean
Default: false
是否开启全部替换
rewriteUrlRules[].rewriteUrlArgsRules[].isIteration
boolean
Default: false
是否开启迭代
redirecthttps
boolean
Default: false
是否将 HTTP 的访问跳转到 HTTPS
useHsts
boolean
Default: false
是否启用 HSTS
usedWafRules
Array of objects
unique
Default: [] Example: {"value":"ruleName","isEnabled":true}
该域名的 WAF 规则。规则按顺序检查并执行,例如,第一条规则触发"允许"操作后,不再检查后续规则。
errorHtmlPageName
string
Default: "default"
当访问出现 5xx 错误时显示在客户端上的错误页面 cresources.htmlpages.list
upstreamTimeout
integer
Default: 60 Enum: 60 120 180
回源超时数值设定
isEnabledCompressionToOrigin
boolean
Default: true
是否启用源站压缩功能。预设开启。
isInsertRidHeaderToOrigin
boolean
Default: false
如果启用,CDN 将在客户访问时插入我们平台生成的 rid header
setCustomHostHeader
string
Default: "off" Enum: "on" "off"
如果启用,CDN 将在回源时透过指定的 host header 回源
customHostHeader
string
Example: "example.com"
必填 body 值,当 setCustomHostHeader 为 "on" 时需填入指定回源
websocketPath
string
Default: ""
多个路径,用\n分隔
proxyBufferSize
integer
Default: 4 Enum: 2 4 8 16 32 64
设置客户端请求传递给 CDN 时使用的缓冲区大小
proxySetHeader
Array of strings
Default: [] Example: ["CDN-Request-ID","CDN-IP-Location","CDN-Internet-Service-Provider",”CDN-JA3”,” CDN-JA3-Hash”]
Edge 插入请求表头并回传到源站,若源站需抓取此表头 log,参考设置为以下 : http_cdn_request_id http_cdn_ip_location http_cdn_internet_service_provider http_cdn_ja3 http_cdn_ja3_hash ”custom_key” (詳請參考欄位customVariables)
isUpgradeInsecureRequest
boolean
Default: false
启用 UpgradeInsecureRequest header,该 header 可以尝试将 "http" 请求切换为 "https" 请求
maxUploadSize
integer
[ 1 .. 100 ]
Default: 1 Unit is MB
客户端和 CDN 之间的最大上传大小限制
cusFollowCachePath
string
Default: ""
缓存遵循源站路径,多个路径用\n分隔
cusFollowCacheFile
string
Default: ""
缓存遵循源站文件,多个路径用\n分隔
cusCachepathExp
string
Default: "5"
浏览器上的缓存路径到期时间。预设为 5 分钟,设定范围:5-129600 分钟。
cusCachepathSrvexp
string
Default: "5"
CDN 上的缓存路径到期时间。预设为 5 分钟,设定范围:5-129600 分钟。
cusCachefileExp
string
Default: "5"
浏览器上的缓存文件到期时间。预设为 5 分钟,设定范围:5-129600 分钟。
cusCachefileSrvexp
string
Default: "5"
CDN 上的缓存文件到期时间。预设为 5 分钟,设定范围:5-129600 分钟。
defCachefileExp
string
Default: "5"
未指定时,浏览器上的默认缓存文件到期时间。预设为 5 分钟,设定范围:5-129600 分钟。
defCachefileSrvexp
string
Default: "5"
未指定时,CDN 上的默认缓存文件到期时间。预设为 5 分钟,设定范围:5-129600 分钟。
proxyCacheIgnoreArgs
boolean
Default: false
是否忽略参数的缓存键
cusCachepath
string
Default: ""
域名的缓存路径,多个路径用\n分隔
cusCachefile
string
Default: ""
域名的缓存文件,多个路径用\n分隔
forceCusCachePath
string
Default: ""
域名的强制缓存路径,多个路径用\n分隔
forceCusCacheFile
string
Default: ""
域名的强制缓存文件,多个路径用\n分隔
cusNoncachepath
string
Default: ""
域名的不缓存路径,多个路径用\n分隔
cusNonachefile
string
Default: ""
域名的不缓存文件,多个路径用\n分隔
defNoncachepath
string
Default: "/"
域名的不缓存路径,多个路径用\n分隔
isAcceptHttpV1
boolean
Default: false
是否接受以 HTTP v1 的形式访问
isEnabledUpstreamHttp11
boolean
Default: true
是否启用 HTTP 1.1 回源
redirectHttpCode
string
Default: "302"
重定向 HTTP 代码
customVariables
Array of objects
Default: [] Example: {"key": "custom_key", "value": "custom_value"}
自訂變數選項,填寫後可將key用於proxySetHeader 欄位當中
3. resources.appProfiles.get 取得专案信息
Method : GET
① 示范 (curl 模式)
Path :
appProfileId
required
string
<groupName>-<appProfileName> Example:cdn-xxx-my-profile
格式为 群组名称 - 专案名称
Parameter :
groupName
required
string
groupName=cdn-xxx
项目的群组名称
4. resources.appProfiles.update 更新专案信息
Method : PATCH
① 示范 (curl 模式)
Path :
appProfileId
required
string
<groupName>-<appProfileName> Example:cdn-xxx-my-profile
格式为 群组名称 - 专案名称
Parameter :
groupName
required
string
groupName=cdn-xxx
项目的群组名称
Body :
description
string
Default: ""
描述字段内容
tags
Array of strings
unique
Default: [""]
标签内容
serviceGroupName
string
Example: "cdn-xxx-a01-ws"
指定 servicegroup,参见 resources.servicegroups.list
useOriginPolicy
boolean
Default: false
是否使用回源策略
usedOriginPolicies
Array of objects
unique
Default: [] Example: {"regionName": ["default" ],"originPolicyName": "testoriginpolicy"}
填写回源策略名称,仅在 useOriginPolicy:true 时生效,useOriginPolicy:true 时必填 body 值
regionName 可以填写国家代码 ex: china=CN,Hongkong=HK,default 必填
origins
Array of strings
>= 0 items unique
Example: ["1.1.1.1","www.example.com"]
填写回源目标,支持公网 IP 和完全域名,仅在 useOriginPolicy:false 时生效
originscheme
string
Default: "http" Enum: "http" "https"
该域名的来源协定
portMappingType
string
Default: "default" Enum: "default" "static"
该域名的端口映射类型
originPort
integer
Default: 80
该域名的来源端口
scheme
Array of strings
non-empty unique
Default: "http" "https" Enum: "http" "https"
该域支持的访问模式
httpPort
Array of integers
non-empty unique
Default: [80]
http 监听端口。 多选,可选范围 80, 8080, 8880, 2052, 2082, 2086, 2095。 预设:[80]
httpsPort
Array of integers
non-empty unique
Default: [443]
https 监听端口。 多选,可选范围 443 及 1001-4999、6001-32767。除了 httpPort 和 9600 不可选。 预设:[443]
redirecthttps
boolean
Default: false
是否将 HTTP 的访问跳转到 HTTPS
useHsts
boolean
Default: false
是否启用 HSTS
usedWafRules
Array of objects
unique
Default: [] Example: {"value":"ruleName","isEnabled":true}
该域名的 WAF 规则,必填 body。规则将按顺序检查和依序执行下去,例如,如果第一条规则触发"允许"操作,则不会检查之后的规则。
errorHtmlPageName
string
Default: "default"
当访问出现 5xx 错误时显示在客户端上的错误页面 cresources.htmlpages.list
upstreamTimeout
integer
Default: 60 Enum: 60 120 180
回源超时数值设定
isEnabledCompressionToOrigin
boolean
Default: true
是否启用源站压缩功能。预设开启。
isInsertRidHeaderToOrigin
boolean
Default: false
如果启用,CDN 将在客户访问时插入我们平台生成的 rid header
setCustomHostHeader
string
Default: "off" Enum: "on" "off"
如果启用,CDN 将在回源时透过指定的 host header 回源
customHostHeader
string
Example: "example.com"
必填 body 值,当 setCustomHostHeader:"on" 时需填入指定回源
websocketPath
string
Default: ""
多个路径,用\n分隔
proxyBufferSize
integer
Default: 4 Enum: 2 4 8 16 32 64
设置客户端请求传递给 CDN 时使用的缓冲区大小
proxySetHeader
Array of strings
Default: [] Example: ["CDN-Request-ID","CDN-IP-Location","CDN-Internet-Service-Provider",”CDN-JA3”,” CDN-JA3-Hash”]
Edge 插入请求表头并回传到源站,若源站需抓取此表头 log,参考设置为以下 : http_cdn_request_id http_cdn_ip_location http_cdn_internet_service_provider http_cdn_ja3 http_cdn_ja3_hash ”custom_key” (詳請參考欄位customVariables)
isUpgradeInsecureRequest
boolean
Default: false
启用 UpgradeInsecureRequest header,该 header 可以尝试将"http"请求切换为"https"请求
maxUploadSize
integer
[ 1 .. 100 ]
Default: 1 Unit is MB
客户端和 CDN 之间的最大上传大小限制
cusFollowCachePath
string
Default: ""
缓存遵循源站路径,多个路径,用\n分隔
cusFollowCacheFile
string
Default: ""
缓存遵循源站档案,多个路径,用\n分隔
cusCachepathExp
string
Default: "5"
浏览器上的缓存路径到期时间。预设为 5 分钟,设定范围:5-129600 分钟。
cusCachepathSrvexp
string
Default: "5"
CDN 上的缓存路径到期时间。预设为 5 分钟,设定范围:5-129600 分钟。
cusCachefileExp
string
Default: "5"
浏览器上的缓存文件到期时间。预设为 5 分钟,设定范围:5-129600 分钟。
cusCachefileSrvexp
string
Default: "5"
CDN 上的缓存文件到期时间。预设为 5 分钟,设定范围:5-129600 分钟。
defCachefileExp
string
Default: "5"
未指定时,浏览器上的默认缓存文件到期时间。预设为 5 分钟,设定范围:5-129600 分钟。
defCachefileSrvexp
string
Default: "5"
未指定时,CDN 上的默认缓存文件到期时间。预设为 5 分钟,设定范围:5-129600 分钟。
proxyCacheIgnoreArgs
boolean
Default: false
是否忽略参数的缓存键
cusCachepath
string
Default: ""
域名的缓存路径,多个路径用\n分隔
cusCachefile
string
Default: ""
域名的缓存文件,多个路径用\n分隔
forceCusCachePath
string
Default: ""
域名的强制缓存路径,多个路径用\n分隔
forceCusCacheFile
string
Default: ""
域名的强制缓存文件,多个路径用\n分隔
cusNoncachepath
string
Default: ""
域名的不缓存路径,多个路径用\n分隔
cusNonachefile
string
Default: ""
域名的不缓存文件,多个路径用\n分隔
defNoncachepath
string
Default: "/"
域名的不缓存文件,多个路径用\n分隔
isAcceptHttpV1
boolean
Default: false
是否接受以 HTTP v1 的形式访问
isEnabledUpstreamHttp11
boolean
Default: true
是否启用 HTTP 1.1 回源
redirectHttpCode
string
Default: "302"
重定向 HTTP 代码
customVariables
Array of objects
Default: [] Example: {"key": "custom_key", "value": "custom_value"}
自訂變數選項,填寫後可將key用於proxySetHeader 欄位當中
5. resources.appProfiles.delete 删除专案信息
Method : DELETE
① 示范 (curl 模式)
Path :
appProfileId
required
string
<groupName>-<appProfileName> Example:cdn-xxx-my-profile
格式为 群组名称 - 专案名称
Parameter :
groupName
required
string
groupName=cdn-xxx
项目的群组名称
6. purge cache of the app-profile 针对专案清除缓存
Method : POST
① 示范 (curl 模式)
Parameter :
groupName
required
string
groupName=cdn-xxx
项目的群组名称
Body :
appProfileName
required
string
my-profile1.com
项目的专案名称
key
Array of objects
non-empty
/image
清除缓存路径/资源格式
7. OWASP 相关设定
Method : 添加专案 : POST
Method : 更新专案 : PATCH
① 示范 (curl 模式)
Parameter :
groupName
required
string
groupName=cdn-xxx
项目的群组名称
Body :
isUseOwasp
boolean
Default: false
使用 OWASP 开关
owaspRuleName
required if isUseOwasp is true
string
Example: "sys_default"
OWASP 规则,当 isUseOwasp 为 true 时必填
8. 回源 URL 改写设定
Method : 添加专案 : POST
Method : 更新专案 : PATCH
① 示范 (curl 模式)
Parameter :
groupName
required
string
groupName=cdn-xxx
项目的群组名称
Body :
rewriteUrlRules
Array of objects
Example: See below
改写回源 URL 的规则集合
description
string
Default: ""
描述此改写规则的用途
isRewriteUrlPath
boolean
Default: false
是否启用路径改写
sourcePath
string
Default: ""
改写目标路径
destPath
string
Default: ""
替换路径
isReplaceAll
boolean
Default: false
是否开启全部替换
isIteration
boolean
Default: false
是否开启迭代
isRewriteUrlArgs
boolean
Default: false
是否启用 args 改写
rewriteUrlArgsRules
Array of objects
Default: []
改写 args 的规则集合
sourceArgs
string
Default: ""
改写目标 args
destArgs
string
Default: ""
替换 args
isReplaceAll
boolean
Default: false
是否开启全部替换
isIteration
boolean
Default: false
是否开启迭代
9. 进阶缓存设定
Method : 添加专案时增加进阶缓存设定 : POST
Method : 更新进阶缓存设定 : PATCH
① 示范 (curl 模式)
Parameter :
groupName
required
string
groupName=cdn-xxx
项目的群组名称
Body:
cacheUrlRules
Array of objects
Example: See below
进阶缓存规则集合,以 "{ }" 分开多条规则
cacheType
String
Default: "" Example: "cache"
缓存类型,栏位可套用唯一值如下: - followOrigin (遵循源站) - cache (缓存) - notCache (不缓存)
uriPath
String
Default: "" Example: "/rule1"
指定缓存路径
description
String
Default: "" Example: "this-is-rule1"
描述此缓存规则的用途
isSlice
Boolean
Default: false Example: "true"
是否开启拆分缓存大小功能
slice
Number
Default: Example: "5"
缓存文件拆分大小,单位 : MB
browserExp
Number
Default: Example: "5"
资源在浏览器过期时间,单位 : min
serverExp
Number
Default: Example: "5"
资源在服务器过期时间,单位 : min
argsType
Array of objects
Default: []
Args 缓存规则集合,栏位可套用唯一值如下: - keepAll (全部保留) - ignoreAll (全部忽略) - keepParams (保留指定参数,其余忽略) - ignoreParams (忽略指定参数,其余保留)
argsRules
Array of objects Key : string Value : string
Default: [] Example: [{"key": "456", "value":"789"}, "key": "123", "value":"321"}]
argsType 缓存规则的详细对象参数
Last updated