*

webcity

  • *****
  • 252 posts
Cache .css files
« on: April 25, 2021, 03:43:56 AM »
Hi,

I use Cloudflare to speed up my site as some of my customers are on the other side of the world to the server.

I notice that that some .css and .js files are in the format : oc-content/themes/gamma/css/responsive.css?v=12345678901236 . The v=12345678901236 changes every page load so stops the file being cached, which is slowing down the page load time.

I there a way to cache these file types and use etags instead to check if they have been updated or to use the same v=12345678901236 every time until there is a change in the .css file? Or can you tell me where I can remove the ?v=12345678901236 code?

Many thanks,
Spencer

*

MB Themes

Re: Cache .css files
« Reply #1 on: April 25, 2021, 08:27:22 AM »
Problem is, that sometimes hosting use hard cache methods and is not simple to clean that cache.
Currently we mostly use date as version number, you can simply change this i.e to v=2 and in case you did updates, you change it to +1.
Btw. free cloudflare cdn service does nothing.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

Marked as best answer by frosticek on April 25, 2021, 10:04:50 AM
*

webcity

  • *****
  • 252 posts
Re: Cache .css files
« Reply #2 on: April 25, 2021, 09:13:20 AM »
Hi,

Thanks for the reply and help.

I managed to find a solution using Cloudflares page rules:
*.mydomain.com/oc-content/themes/gamma/*/*.*?v=*
Browser Cache TTL: a year, Cache Level: Ignore Query String, Edge Cache TTL: a month

Seems to work OK.

Many thanks,
Spencer

*

MB Themes

Re: Cache .css files
« Reply #3 on: April 25, 2021, 10:05:02 AM »
Looks good;)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots