Streaming live at 10am (PST)

How do I leverage browser Caching?


#1

Hi, I’m always been told by the SEO testers to ‘Leverage Browser Caching’ how do I do this in Webflow?


#2

https://varvy.com/pagespeed/leverage-browser-caching.html

Edit:

Obviously doesn’t work if you are hosting in webflow, with no file access. This is for working (designing) in webflow while also exporting code.


#3

I don’t think any of that information helps while you’re working in Webflow, if I understand @Roxzfr’s question correctly.

But I do remember seeing this in the Wishlist:
https://wishlist.webflow.com/ideas/WEBFLOW-I-459


#4

Yeah @NewInBoston but you can’t do this in Webflow unless you export your site… in which case it’s possible… but then you can’t re-import it again. There’s no way to access file structure if hosting in Webflow, it’s on their servers. I do think it has been posted to the Wishlist though, so maybe a future addition will come later.


#5

This is correct.

If you do your own hosting, you can create a .htaccess file similar to this:

Header unset Pragma
FileETag None
Header unset ETag
Header unset Last-Modified
Header set Cache-Control "must-revalidate, max-age=30"

This is a directive to be included in the headers of the response to the visitor’s browser, to tell it how to cache (or otherwise). The above example is to tell the browser to only cache it for 30 seconds, usually you will set it to a higher value like a day or week.

Technical details:

https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching


#6

These duplicate thread(s) may already have a solution for you:


Please try to search the forum before asking a question. Thank you!


#7

Thank you all. I did search the forum but didn’t understand half the answers - now I do, thank you!


#8

Well there is no chance you can do anything until you remain with webflow because you don’t have the access of the website file. In general all you need is to add a couple of code to .htaccess file and problem solved.

Here is the code:

ExpiresActive On
ExpiresByType image/jpg “access 1 year”
ExpiresByType image/jpeg “access 1 year”
ExpiresByType image/gif “access 1 year”
ExpiresByType image/png “access 1 year”
ExpiresByType text/css “access 1 month”
ExpiresByType text/html “access 1 month”
ExpiresByType application/pdf “access 1 month”
ExpiresByType text/x-javascript “access 1 month”
ExpiresByType application/x-shockwave-flash “access 1 month”
ExpiresByType image/x-icon “access 1 year”
ExpiresDefault “access 1 month”

You can look the following guide on Leverage Browser Caching In WordPress to dive in further and see if you can do anything. All the best mate.