[英]AWS CloudFront will only invalidate entire cache
I want to invalidate the CloudFront cache entry for a specific path, say /api/dict/bob/article/1
, but it has no effect.我想使特定路径的 CloudFront 缓存条目无效,例如
/api/dict/bob/article/1
,但它没有效果。 I've experimented with different wildcards, for instance:我尝试了不同的通配符,例如:
/*/1
/api/dict/bob/article/*
/api/dict/bob/*
/api/dict/*
But in the end, the only invalidation that actually removes the object from the cache is the catch-all /*
但最后,真正从缓存中删除 object 的唯一失效是 catch-all
/*
The path's origin is custom (API Gateway)路径的来源是自定义的(API 网关)
Cache policy: Minimum TTL: 60, Maximum TTL:28800, Default TTL: 10800缓存策略:最小 TTL:60,最大 TTL:28800,默认 TTL:10800
Cache key:缓存键:
Update: I managed to invalidate an svg-file from an s3 origin.更新:我设法使来自 s3 源的 svg 文件无效。 The api origin requires an
x-api-key
http-header. api 源需要
x-api-key
http-header。 Could that make a difference?这会有所作为吗?
I think * can be only in the end.我认为 * 只能在最后。 Are you sure it is not a client caching and you waited for the invalidation to finish?
您确定它不是客户端缓存并且您等待失效完成吗? It is a slow process, not instant for sure.
这是一个缓慢的过程,肯定不是瞬间的。 You can track its progress either on the UI or using the CLI.
您可以在 UI 上或使用 CLI 跟踪其进度。
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html
To invalidate files, you can specify either the path for individual files or a path that ends with the * wildcard, which might apply to one file or to many, as shown in the following examples:
要使文件无效,您可以指定单个文件的路径或以 * 通配符结尾的路径,这可能适用于一个文件或多个文件,如以下示例所示:
/images/image1.jpg
/images/image1.jpg
/images/image*
/图像/图像*
/images/*
/图片/*
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.