Is it possible to cache static html while ignore query string?

My site is using Hexo which is a static blog framework. That means every page is a single HTML. No matter what query string is, the page is always the same. So I want to cache static HTML at Cloudflare and ignore query strings.

Currently I have added a page rule like this:*

- Origin Cache Control: On
(I have added cache-control header at my origin server and I want Cloudflare to follow the TTL I set)

- Cache Level: Cache Everything

When Cache Level is Cache Everything, Cloudflare will not hit the cache when query string changes
If I set Cache Level to Ignore Query String, Cloudflare will not cache HTML even though I have add cache-control: public,max-age=600,s-max-age=3600.
What should I do to achieve both of ignore query string and cache static HTML at Cloudflare?

Have you tried setting “ignore query string” globablly under caching and the use a page rule to cache everything?

Emmm, I have changed the global cache settings to Ignore Query String at Cache App of Dashboard. But it seems not work:

In that case it would seem as if the page rule really overrides the global setting.

I guess you cant achieve your goal with the regular settings. Possibly a custom worker could accomplish that, but then that would be a paid feature.

@cscharff, maybe a good idea to split the query string related settings from the overall cache directives.

Yeah. I think it is better to split the cache behavior of query string (No or Ignore) and the cache behavior of some specific mime type of file (.html for example).

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