Cache dynamic content ☹ [Workers help needed]

Hi I currently have a eCommerce made with prestashop and after month of using Cloudflare I noticed that the html petition (witch is the one that takes the most time to return) is being marked as “dynamic” and not being cached. :frowning:

I understand why CF is doing this, but I would like some static pages to be cached. (blog posts, landings, etc)
Prestashop sets the cache header “Cache-Control” to “no-cache” so origin cache control (in page rules) is not viable.
Each page rule is 1$, so, listing individual URLs is also not viable.
So, what options I have left? It would be nice to avoid having to pay for a business account (to enable Bypass Cache on Cookie).

The only thing that I can think of is setting up a worker that edits the headers on a number of given URLs, but I have no idea of what those headers need to be or how to program the dam thing.

Hi @x.martinez,

If the URLs of the pages you need to cache already have a pattern, you can use it by setting a Page Rule that matches this pattern.

For example:


Both pages would be covered by a single Page Rule like:


If the pattern does not exist but you can create it (I am not familiar with Prestashop), this could be an easy way.

The solution through Workers is probably possible, but I won’t be able to help you with that.

1 Like

Hi @dmz, unfortunately there are no common pattern on the url and they at least 10-15 (on top of my head) urls that should be bypassed. (also, ideally, some pages should be cached or not depending on some kind of logic, (user is logged in or has item in their cart).
So workers, as you stated seem to be the only plausible option. I’ll have to wait to see if I’m lucky and a worker expert finds this posts.

1 Like

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