Hi,
I have started using Cloudflare APO for my wordpress/woocommerce webite which enables dynamic caching. The issue I’m now getting is that (depending which country a customer is from) I’m showing products with different currencies and VAT rates. Before using Cloudflare I was using quic.cloud and here I could define which cookies an/or query strings should trigger a new cache variant (e.g. one cookie for currency, a second one for country, a third one for VAT yes/no and quic.cloud saves a cache variant for e.g. UK/GBP/VAT, UK/GBP/NO VAT, US/USD/NO VAT, DE/EUR/VAT, DE/EUR/NO VAT, NL/EUR, NL/EUR/NO VAT, etc.). It seems that it isn’t possible to configure something like this with Cloudflare APO, so the only option is to completely disable the dynamic caching (which makes APO quite useless).
Any ideas how this could be achieved?
1 Like
Enterprise plan users can set cache keys based on cookies. Otherwise, if you can set your origin to use query strings as opposed to cookies to differentiate different combinations of currency, country and VAT, you could combine APO with a Cache Everything Page Rule (or use the new Cache Rules with even more flexibility).
Hi,
thanks for the reply.
But wouldn’t the “cache everything” rule also start caching logged in users and so serve “private” content to the wrong user?
I was discussing this with the developer of my multi-currency plugin and he says due to the inflexibility of Cloudflare’s caching approach the only thing he could imagine how to enable dynamic caching of multi currency pages is by either re-writing multi currency related query strings into URLs to trick Cloudflare to cache these (e.g. mywebshop/product1/?EUR&UK&VAT becomes mywebshop/product1/EUR_UK_VAT) or by refreshing prices through AJAX calls after loading the page.
These are all quite “dirty” workarounds for a problem which should be fixed by the CDN providers in my opinion.
1 Like
The solution exists but requires Enterprise Plan (as previously mentioned by @cbrandt).
Also, has your developer actually taken a look at the new Cache Rules (Beta) and found this equally “inflexible”?
1 Like
Thanks for the hint to the cache rules (beta), this may help in combination with query strings. I’ll have a look into these.
1 Like