How to purge the cache of a static html page which has params in the url?

cache

#1

I have a static html which is localized, hence having a locale param in the url. I want this page getting cached which is working fine. As soon as I do an update i run a custom purge via api which contains the root url and all urls with locales.
Now i happened that another site backlinked to us with another affiliate query param which is not of interest for us but it ends up being cached and does to get refreshed since our custom purge call is not aware of this url?
So how can i cache a site with only known params (e.g. only the locale param) or can I purge the cache with a wildcard for all params?
regards,
phil


#2

You may want to “Purge Everything” and that would take care of it, but it might be overkill.

How many known parameters are there?

Would an ability to block unknown parameters be an option for you?


#3

“purge everything” is unfortunately not an option. we are running a saas platform g, so when one tenant triggers the purge, others should not be affected, right?!
Currently we just have one param, thats why I started using a custom purge which takes care of all param variants.
blocking unknown params might be an option, but this would mean that i would have to reject the request somehow, but that feels too restrictive


#4

Here’s a long thread on a similar issue with Facebook adding on an unwanted parameter interfering with Cloudflare caching:


#5

thanks a lot for pointing me to this thread, very interesting to read. I am also prone to use serviceworkers since they are the best solution performancewise. But all these solutions assume that you know the “foreign parameter”.
So how to deal with a change of the parameter without getting noticed about it (I am not scanning my logs for every request, right g )


#6

since catch tag is enterprise only, your solution may be developing your inhouse cache tag, I actually have this in place and the logic is pretty simple

each page can have many tags, each tag has a list of the urls its persist on

you should have 2 methods at least:
purging url: remove the page from cache, remove the page url from all its tags list
purging by tag: for each url in the list purge it and remove from tag list

your other option is just have some gate which remove all unwanted parameters and redirect the page


#7

This topic was automatically closed after 14 days. New replies are no longer allowed.