[type or paste code here](http://illogicalmusic.com)
Describe the issue you are having:
I can’t tell if my pages are being cashed. I have a script on my website that changes some of the colors every time it runs. If the page was cached the colors should not be changing, but they are!
What are the steps to reproduce the error:
go to [Preformatted text](https://illogicalmusic.com/Music/1042/Down_the_Line/)
reload the page. If the color changes that means it was pulled from my server.
Which Cloudflare product are you using to cache your pages that is not working?
Cloudflare does not cache HTML by default. You need to use either a Page Rule or a Cache Rule (beta) to have HTML cached, or else use Workers or APO for WordPress.
I don’t understand the terminology. I have read the instructions and they don’t tell me how the content is cached. I understood that everything is cached except what you specify in the rules.
On free plan, you’ve only got us, the community discord, and other community resources.
Not really. HTML is not cached by default unless you specify a rule to make it so. There are other exceptions as well, by default you need cache control/expire headers, to be in the default file extensions list, and not having any set-cookie headers to start with.
I would read over the default cache behavior: Default Cache Behavior · Cloudflare Cache (CDN) docs, as well as the docs on how to customize caching: Customize Caching · Cloudflare Cache (CDN) docs
You can use Cache Rules or the older Page Rules to force caching of HTML. If it works for you, you can cache everything with a simple Page Rule (URL: illogicalmusic.com/*), or with a Cache Rule (hostnameequalsillogicalmusic.com).
If specific parts of your website cannot be cached, you’ll have to create more specific rules. Pages Rules can be ordered and only one execute per URL (i.e you can disable caching for specific paths by having more specific pages rules higher in the order). For Cache Rules, every rule will execute and override the last, but you can have your rule only force caching if hostname equals and if the path does not contain certain values.
From a quick look at your website, it looks like it’s entirely static and a simple cache everything rule would be a good start. Just remember, the duration you set is the length Cloudflare will at max hold the asset in cache for. It’s not a guarantee, it may be evicted before, but it also means if you change content on your origin web server, you’ll need to purge all cache or wait for the edge cache to expire.
Thank you Chaika!
I did what you said and the caching works.
But:
The cookie rule for bypassing is not working ( as if it does not exist!) I tested it by itself and it does not work!
(http.cookie eq “member=value”)
Also:
I can not connect to my server through FTP which is a major problem! It is probably a name server issue but I do not understand the Cloudflare DNS configuration. The instructions given are incomplete.
I have solved the ftp problem, but the bypass if cookie rule does not work.
(http.cookie eq “member=value”)
What am I doing wrong. I am trying to follow the instructions but they are quite vague!
http.cookie is a field that contains all cookies, seperated by semicolons
If you have any other cookie then that single member cookie, that would break.
I would use the http.request.cookies map.
For example, if you want to check if member is a cookie equal to value, you could use
any(http.request.cookies["member"][*] == "value")
Edit: If you’re using Cache Rules, it looks like you may just have to use contains, looks like they can’t access http.request.cookies.
Thank you Chaika! Very helpful.
I got it working now for the most part.
Here is the new problem.
When the bypass happens I get the page from my server, but:
The images are still the cached images. So if an image (with the same name) ie. img.png is updated the bypassed page does not show the current image file but it shoes the cached one.
I want the images to be cached but I want to see what is on the server when caching is bypassed. Can not find any documentation on this.
Any ideas?