code4romania / covid-19-ce-trebuie-sa-fac

Web platform with guides & questionnaires for keeping people informed.
https://cetrebuiesafac.ro
Mozilla Public License 2.0
19 stars 21 forks source link

Serve static assets with an efficient cache policy #211

Open Utwo opened 4 years ago

Utwo commented 4 years ago

Serve static assets (js, css, woff2) with an efficient cache policy. Because files have unique hash in filename, a long cache lifetime can be used.

andreibesleaga commented 4 years ago

This can't be adjusted in AmazonS3/cloudfront from where the website is served ? (some cache control settings ?) Either that or modified serviceworker ? (https://stackoverflow.com/questions/46038668/how-to-modify-auto-generated-service-worker-in-create-react-app)

Utwo commented 4 years ago

Yes, this must be adjusted on AWS side.

andreibesleaga commented 4 years ago

There is documentation for those settings: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/header-caching.html

https://medium.com/@joecrobak/production-deploy-of-a-single-page-app-using-s3-and-cloudfront-d4aa2d170aa3

https://www.edureka.co/community/989/is-there-a-way-to-add-cache-control-in-aws-s3