bench
bench copied to clipboard
Serve static assets with an efficient cache policy
Is your feature request related to a problem? Please describe.
Google PageSpeed Insight complains that static files served by frappe don't have a caching policy. For example, I'm serving a slideshow on a frappe-based website. The images will be loaded again and again, every time I visit the site.
Describe the solution you'd like
Serve static assets with an efficient cache policy.
Probably we can add some lines here to attach a cache policy to images served.
https://github.com/frappe/bench/blob/777b204490cd4bc96eea9fe9ef0cefccd17b4ba4/bench/config/templates/nginx.conf#L77-L89
For example, I'm serving a slideshow on a frappe-based website. The images will be loaded again and again, every time I visit the site.
I don't think this is true as even without cache-control headers browsers will still cache things heuristically. 👀 Open the network tab and check. They'd most likely be loaded from disk. Please confirm if that's not happening ( much worse scenario)
@ankush I can confirm that Chrome automatically caches files for the short term (i.e., hitting reload does not download the files again). But I expect this cache is short term and will not survive a browser restart, etc. This issue is in regard to long term caching (say, a couple of months or until the content changes).
1.5 mil request with response, 0.5mil more with 304 on FC. EVERYDAY! :rofl: