Search code examples
cloudflarehttp-caching

CloudFlare page rule not caching as expected


I'm serving up pages in the URL format of..

http://www.website.co.uk/234242/title-of-web-post

I'm trying to set it to cache everything for these posts using the page rule of

*website.co.uk/*/* 

but looking at the analytics in cloud flare its only caching a small amount of requests.

Am I misunderstanding the syntax of the page rules? What am I doing wrong here?

enter image description here

Edit: just to clarify...the below is my desired outcome

Cached

http://www.website.co.uk/432432/funny-cats
http://www.website.co.uk/234234/cool-trees

Not cached

http://www.website.co.uk
http://www.website.co.uk/sitemap.txt

Solution

  • It looks correct to me, unless that /*/* gives it trouble identifying the pattern correctly.

    Do note that it keeps one cached copy per EDGE node, so you will still see one request for each EDGE node used to access your page. For a low-volume site, this can give you lower percentage of cached request than you expect.

    The response headers that you receive from he request, indicates if the request is cached or not, especially with this header:

    CF-Cache-Status:HIT
    

    Which will show MISS if it wasn't cached at the EDGE node. If missed, subsequent request should respond with a HIT if the rules are setup correctly.