使用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模板。但我也需要转发饼干。在QueryString行之后,我插入了Cookies = "All",但是构建失败了。
错误信息:
TypeError: <class 'troposphere.cloudfront.ForwardedValues'>: None.Cookies is <class 'str'>, expected <class 'troposphere.cloudfront.Cookies'>
我需要添加什么,这样它才不会使生成和转发cookie失败。
发布于 2019-07-11 06:43:24
我在看完这个文档后就把它写好了
在行QueryString = True,之后,我添加了
Cookies = Cookies(Forward = "all"),和它现在构建时没有错误,并将正确的cookie值添加到json模板中。
https://stackoverflow.com/questions/56979350
复制相似问题