Page Rule to hit cache

Hi,

I have set a page rule to match kkk.com/s to “Browser Cache TTL: a day, Cache Level: Cache Everything, Edge Cache TTL: a day”

And I will do a query like: https://www.kkk.com/s/?q=123

What I found is, if I use the same keyword to search, the return header will have " cf-cache-status:HIT “.
But If I change the search keyword, for example use ‘456’ instead of '123. The return header will have " cf-cache-status: MISS” .

My understanding is the ‘Cache Everything’ rule will ignore query keyword, isn’t it?

Thanks

It’s the opposite. Cache Everything will only cache matched query strings. Which is good. You don’t want to query for 456, but get the results for 123.

I did not mention that this page is doing query in the page using ajax to another server. The page is just a static html page, so caching the page is not a problem.

What shall I do to let cloudflare cache the page no matter what query is provided?

Thanks

You just said it was getting a HIT. Unfortunately, you can’t do a Cache Everything and Ignore Query String at the same time…without some trickery, like this (remove the query string):

It sounds like that trick will work perfectly here. You still have the query params available in browser to do your query from js, but Cloudflare will strip them before checking cache and loading the page from origin.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.