使用 troposhphere,我正在尝试创建 CloudFront 分配。
CacheBehaviors = [
CacheBehavior(
TargetOriginId = Join("", ["cloudfront-", Ref("ParamOriginName")]),
PathPattern = '/en/Login/*',
AllowedMethods = ["GET", "HEAD", "OPTIONS", "PUT", "POST","PATCH"],
ForwardedValues = ForwardedValues(
QueryString = True,
Headers = ["user-agent",
"Host",
"CloudFront-Forwarded-Proto",
"CloudFront-Is-Desktop-Viewer",
"CloudFront-Is-Mobile-Viewer",
"CloudFront-Is-SmartTV-Viewer",
"CloudFront-Is-Tablet-Viewer",
"CloudFront-Viewer-Country",
"Origin",
"Referer"]
),
MaxTTL = 86400,
MinTTL = 14400,
DefaultTTL = 43200,
ViewerProtocolPolicy = "redirect-to-https",
Compress = True,
),
这似乎可以很好地构建 json 模板。但我还需要转发 cookie。QueryString
在我插入的行之后,Cookies = "All"
但这使构建失败。
错误信息:
TypeError: <class 'troposphere.cloudfront.ForwardedValues'>: None.Cookies is <class 'str'>, expected <class 'troposphere.cloudfront.Cookies'>
我需要添加什么以便它不会使构建失败并转发 cookie