- 新しい順
- 投票が多い順
- コメントが多い順
To disable caching completely, go to CloudFront console, click on the ID value of your CloudFront distribution and navigate to Behaviors
section. Select and edit the default entry. Your CachePolicy
is probably set to CachingOptimized
. Change it to CachingDisabled
and save.
To cache only .EXE file, click Create behavior
to create a new entry. Use *.exe
for Path pattern
and set CachePolicy
to CachingOptimized
Your configuration should be similar to screenshot below
Since your files are already cached, you may want to clear CloudFront cache as well. Go to Invalidations
section and click Create invalidation
Edit: Your configuration looks correct. *.exe files are cached as per curl command below
% curl -I https://download.datanumen.com/downloads/file/daccr.exe
HTTP/2 200
...
vary: Accept-Encoding
x-cache: Hit from cloudfront
...
Others are not cached by CloudFront
% curl -I https://download.datanumen.com/
HTTP/2 200
...
x-cache: Miss from cloudfront
Any caching if any is by your origin (www.datanumen.com). It is using Cloudflare. Suggest you change your CloudFront origin to your EC2 (?) domain name.
Hi,
I check my distribution and find it already have a behavior, so I think the most simple way is to edit it and change the pattern from * to *.exe, as below:
But I cannot make the change. Why?
Hi, Mike
I just follow your instructions, except that we have a custom cache policy with our own defined settings, below is my setting: And I have clear the cache as below:
But, when visiting https://download.datanumen.com (the domain used by Amazon Cloudfront), I will still see our company page. Am I doing something wrong?
Alan, when I go to the following URL (https://download.datanumen.com/sitemap_index.xml), I see that the object is not being cached. CloudFront is returning a 200 (not a 304), and the X-Cache header returns "Miss from cloudfront". It looks like caching is working as expected. What are you expecting to see?
Hello.
I think the following documents will be helpful.
https://repost.aws/knowledge-center/prevent-cloudfront-from-caching-files
I thought it would be a good idea to target only ".exe" by setting the cache key etc.
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html
I recommend following Mike L's instructions, that is exactly what you need to do.
To elaborate, CloudFront uses Behaviors, and you can think of them as rules. They have an order of execution, with 0 being first, 1 next, then 2, etc. Inside a Behavior you define what path you want to match on, in this case *.exe. You also can define other things, such as a caching policy, which origin to use, etc.
関連するコンテンツ
- AWS公式更新しました 2年前
- AWS公式更新しました 3年前
- AWS公式更新しました 3年前
Do not change path pattern for this (Default). Only change CachePolicy to CachingDisabled. Instead, create a new behavior with the same values except for path pattern (*.exe) and caching policy (CachingDisabled). I have updated my post with screenshot