-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimization: Serve static assets with an efficient cache policy #4178
Comments
Django behavior means that the regular response header logic doesn't seem to work for staticfiles. I think we might want to do this on the nginx side https://serverfault.com/a/733567. The static assets currently have a 60 second cache vs the default 5 min cache for the rest of the application, so this is a big opportunity for improvement.
Update: jcarroll wrote: I get |
Just noting that, regardless of how often the servers cache various files, our site's optimization (Lighthouse) scores will only be affected by how long browsers are told they should cache our files.
As far as server caches, though, basically every js, css, and non-blog images could be cached until the next deployment. Same with non-blog pages like data. *cached by a user's browser |
@rfultz Regarding the second bullet above, How would telling the browser ti cache a files with a hash forever avoid polluting the browser's storage? If the file gets a new name (with the prepended hash) then won't cacheing it forever actually do the the opposite because we would be cacheing every time a new hash-name is created? |
We are meeting with cloud.gov for supplemental support hours to pair on this on Tuesday 05/18 at 3:00 pm. Let @johnnyporkchops know if you would like to be added to invite. |
For testing, we added the public route back to the CMS app in the What we ran to add the public route:
What we should run to remove it:
Some very basic notes I took from the pairing session with cloud.gov: https://docs.google.com/document/d/15uvsItbGTvvukkLbEd50wLvfucq0AoekCXpf1R4qS4Q/edit |
Background
Looking to optimize the site's performance and that of the homepage specifically, the Lighthouse tool in Chromium browsers has made some suggestions. Some of these will have repercussions throughout the app so we're going to make them their own tickets.
Recommendation: Serve static assets with an efficient cache policy
A long cache lifetime can speed up repeat visits to your page. details
Overview
Increasing the cache setting will mean users can lean on browser caching longer
Benefit (the 80 of 80/20)
Effort (the 20 of 80/20)
Moderate
Complications
cache-control
max-age
affect files we don't want it to?Related tickets
The text was updated successfully, but these errors were encountered: