我想告诉Azure CDN我的来源是在特定路径,例如mydomain.com/cdn
。此选项可通过Azure门户获取(CDN配置文件>端点>配置>源路径)
我正在使用Resource Manager API和Json模板部署Azure资源。但是,我在模板中找不到此设置:https://github.com/Azure/azure-quickstart-templates/tree/master/201-cdn-customize
这不可用或我遗失了什么吗?
更新
使用资源浏览器,我在端点节点上找到了null
的属性。即使我尝试设置值(并且API接受它),也不会设置该值。
{
"value": [
{
"name": "<hidden>",
"id": "/subscriptions/<hidden>/resourcegroups/<hidden>/providers/Microsoft.Cdn/profiles/<hidden>/endpoints/<hidden>",
"type": "Microsoft.Cdn/profiles/endpoints",
"tags": {},
"location": "NorthEurope",
"properties": {
"hostName": "<hidden>",
"originHostHeader": "<hidden>",
"provisioningState": "Succeeded",
"resourceState": "Running",
"isHttpAllowed": true,
"isHttpsAllowed": true,
"queryStringCachingBehavior": "UseQueryString",
"originPath": null,
"origins": [
{
"name": "<hidden>",
"properties": {
"hostName": "<hidden>",
"httpPort": null,
"httpsPort": null
}
}
],
"contentTypesToCompress": [
"application/x-javascript",
"text/css",
"text/html",
"text/javascript",
"text/plain"
],
"isCompressionEnabled": false
}
}
]
}
答案 0 :(得分:0)
2016年4月15日编辑以更正代码插入
由于这是一个可选配置,因此模板可能没有。 来自azuredeploy.json第97行的部分似乎正在配置CDN端点。如下添加第104行应该会有所帮助。
97 "properties": {
98 "originHostHeader": "[parameters('originUrl')]",
99 "isHttpAllowed": "[parameters('isHttpAllowed')]",
100 "isHttpsAllowed": "[parameters('isHttpsAllowed')]",
101 "queryStringCachingBehavior": "[parameters('queryStringCachingBehavior')]",
102 "contentTypesToCompress": "[parameters('contentTypesToCompress')]",
103 "isCompressionEnabled": "[parameters('isCompressionEnabled')]",
104 "originPath": "[parameters('originPath')]",
105 "origins": [
106 {
107 "name": "origin1",
108 "properties": {
109 "hostName": "[parameters('originUrl')]"
110
111 }
112 }
113 ]
当然,您需要在参数文件中添加此块
"originPath": {
"value": "/cdn"
}
希望这对您有用