On my server, images are called with a string i=xxx where xxx is a random number.
I want Cloudflare to ignore those strings and cache images regardless of those strings.
I thought that this Page Rule woul have worked but it isn’t working.
Browser Cache TTL: a day, Cache Level: Ignore Query String, Edge Cache TTL: a day
What I see on my server is that query strings are stripped when an image is requested, but, if I change even a character in the query string, the image is always requested to the server.
Apart from removing the code that add the string to the images, how can I make Cloudflare ignore the query strings and cache the images regarless of that string?
Which file extensions are we talking about? If these are ones which are by default cached, your page rule should actually work just fine. The only problem would be extensions which are not cached, as you need a cache everything rule, but that would collide with “ignore query string” and that setup is currently not possible via page rules, but you’d need to implement that logic yourself in a Worker.
Can you post a sample URL?
I’m talking about images, jpg, png, gif and so on…
Sample URL: https://www.cicap.org/new/images/b/c/1800711-big.png?i=1234
Change the query string and you’ll see CF-Cache-Status: MISS
These files are cached by default and setting the cache level accordingly should work.
Can you post a screnshot of your rule?
That looks all right. And there is no other page rule before that?
Also, which Cloudflare nameservers were assigned to your domain in your account?
There are no other rules, but it isn’t working
Why do you need the nameservers? You can simply dig to discover them.
To confirm you are looking at the correct account. It’s a relatively common problem that people have added their domain to multiple accounts, but only one of those accounts can ever be active at a time. @sandro wants to compare what you see in your account with what the rest of the world sees.
I don’t think it is needed. As I told you, when I turn on the page rule, requests for the image go to the server without the query string, so I am working on the correct account.
However, here they are:
The problem was the WordPress plugin. By disabling speedwp_cache_by_device, everything began working as expected.
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.