AWS Cloudfront CacheBehavior 的 PathPattern 中可接受的通配符

Acceptable wildcards in PathPattern for AWS Cloudfront CacheBehavior

尝试为我们的应用程序中的路径设置缓存行为,AWS 文档仅显示尾随通配符的示例(即 /images/*https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html#cfn-cloudfront-distribution-cachebehavior-pathpattern, and also https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesPathPattern)。

然而,我们使用的路径模式在路径的其余部分之前实现语言变量,例如 (/{language}/product/{productId})。

在云形成模板中,在每个变量点中使用通配符设置 PathPattern 是否可以接受?

/*/product/*.

如果没有,我使用 /product/* 我相信只有像 https://website.com/product/{productId} 这样的路线会被云端分析,而像 https://website.com/en/product/{productId} 这样的路线会被遗漏。

/*/product/* 对于 https://example.com/en/product/{productId}.

有效且正确

也许 /??/product/* 更正确,因为 ? 恰好匹配 1 个字符,而 * 匹配 0 个或更多字符。

/product/* 与给定的示例不匹配。

还请记住,CloudFront 按优先顺序将请求与路径模式匹配,因此 "first match"(按优先顺序)总是获胜——没有 "best match" 或 [=26= 的概念] 路径模式匹配。