我有一个与失效相关的查询。
我在 s3 存储桶上创建了一个测试页面。 Cloudfront 上设置的 TTL 为 1 周。但是我对测试页做了一些修改。我以 '/*' 的身份运行失效,并希望所有文件都从缓存中逐出。
但页面仍然从 Cloudfront 缓存中获取 --> 响应 header 显示 'x-cache: Hit from cloudfront'
我不确定我在这里遗漏了什么,请提出建议。非常感谢您的建议。
最佳答案
我的问题是我在 macOS 上运行了以下命令:
aws --profile myprofile cloudfront create-invalidation --distribution-id someID --paths /*
原来我的 shell 将 /*
扩展到以下导致错误失效的路径:
/Applications
/home
/Volumes
/private
/Users
/bin
/sbin
/var
/dev
/usr
...
将 /*
转义为 '/*'
解决了这个问题:
aws --profile myprofile cloudfront create-invalidation --distribution-id someID --paths '/*'
关于amazon-web-services - AWS Cloudfront 失效未按预期工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62172836/