I get the following on gtmetrix.com:
Leverage browser caching
E (55)
52%
Server High
What does this mean?
The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:
http://mysite.s3.amazonaws.com/profile.png (expiration not specified)
http://mysite.s3.amazonaws.com/circle.player.css (expiration not specified)
http://mysite.s3.amazonaws.com/main.js (expiration not specified)
http://mysite.s3.amazonaws.com/not.the.skin.css (expiration not specified)
http://cdn-images.mailchimp.com/embedcode/slim-321711.css (expiration not specified)
I'm guessing the mailchimp files can't be modified. But how do I specify a browser cache for Amazon S3 Cloudfront files?
S3 is great for file storage, but it does so much more as well. I love using S3 as a simple caching mechanism for any stateless functions that need to save some ephemeral data to keep state.
The basic idea behind it is the following: The browser requests some content from the web server. If the content is not in the browser cache then it is retrieved directly from the web server. If the content was previously cached, the browser bypasses the server and loads the content directly from its cache.
For s3 files you would go to properties -> metadata section for each file you want to update. Cloudfront takes headers from the origin. Thanks. Are there any examples of what key/value should be used to control browsing caching?
You can specify header parameter with the s3cmd! while uploading files to s3.
eg :
s3cmd sync LOCAL_DIRECTORY s3://BUCKET[/PREFIX] --add-header=Cache-Control:max-age=3153600
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With