Need help with WP Woocommerce Page Rule settings + Problem solving for "Best Upsell" plugin Cart Api Calls

Dear CF Forum Members,

I need your help to setup proper page rules for may wordpress woocommerce store as I am facing a problem of cached API calls of the plugin called “best upsell”.

The best upsell plugin developers stated that the API Call to the URL " ```
MYDOMAIN/wp-json/wc/v3/cartdata


In the enclosed screen shot, you'll find my current page rule settings.
![2buy-CF-PageRules|690x411](upload://bD7HNEtH3S0rmWKZlJAeZmYDtei.png)

Please help to setup the best matching page rules for a optimized secure and fast page performance to use my woocommerce shop without problems, as well not to cache dynamic content + neccessary API calls.

Best regards, 
Alex

P.S. For the testing & resolving purpose I am running now a "clone.mydomain" site and at the main "www.mydomain" site, this plugin is inactive set until it is running on the clone site properly.

Dear CF Forum Members,

I need your help to setup proper page rules for may wordpress woocommerce store as I am facing a problem of cached API calls of the plugin called “best upsell”.

The best upsell plugin developers stated that the API Call to the URL “MYDOMAIN/wp-json/wc/v3/cartdata” is cached, which should not. Therefore the proper setup of page rules should be used to exclude API calls.

In the enclosed screen shot, you’ll find my current page rule settings.

Please help to setup the best matching page rules for a optimized secure and fast page performance to use my woocommerce shop without problems, as well not to cache dynamic content + neccessary API calls.

Best regards,
Alex

P.S. For the testing & resolving purpose I am running now a “clone.mydomain” site and at the main “www.mydomain” site, this plugin is inactive set until it is running on the clone site properly.

Thank you for sharing a screenshot of your Page Rules.

However, unfortunately from your shared screenshot, the 2nd and 3rd rule wouldn’t work at all as that syntax is not supported in Page Rules (the pipe | or operator like using regex or).

I wonder if that’s a JSON response or output :thinking:, if so, you could remove the 2nd and 3rd Page Rule and create a new one with matching *2buy.xyz/wp-json* and Cache Level: Bypass. Would be like:

Otherwise, for a particular match, using a Transform Rules → Modify Response Header and adding the HTTP cache headers to disable caching it, would be like:

Useful article:

Hello fritex,

OK and thank you for your response!

My page rule setting is now (screenshot enclosed):
1 rule (untouchted)
2buy.xyz/wp-content/uploads
Browser Cache TTL: a year, Cache Level: Cache Everything, Edge Cache TTL: a month

2 rule (according your advice)
2buy.xyz/wp-json
Cache Level: Bypass

3 rule (is paused and in need to get more explained as I got the info to set this up from this CF article ( support(dot)Cloudflare(dot)com/hc/en-us/articles/236166048-Caching-Static-HTML-with-WordPress-WooCommerce) and want to make sure that this is also proper working)
.2buy.xyz/|checkout/|cart/|my-account/*
Cache Level: Bypass, Edge Cache TTL: a month

Best regards,
Alex

PS. Unfortunately the selection of the above stated article to “Bypass Cache on Cookies” is not available any more in the page rules. Any ideas how to set this up according the article suggested?

Yes, this ain’t going to work because the syntax not good.

For that kind of a feature, you’d have to be on at least the Business plan:

Business and Enterprise customers can bypass HTML caching when a cookie is sent with a request Bypass Cache on Cookie setting using Cloudflare Page Rules.

More about this here:

However, there seems to be some workaround by using Cloudflare workers (even on a free plan?):

Except, I’d suggest using Paid Bundled Workers (due to the request limits which you might hit per day) here:

Hello Fritex,
thanks for getting back to me.

Well, this seems to be a bit complex for me with the worker approach and for the paid upgrade I need first to earn some money with the shop :wink:

Here again the rulse I’ve set and seems to work for now

  1. Rule
    2buy.xyz/wp-content/uploads
    Browser Cache TTL: a day, Cache Level: Cache Everything, Edge Cache TTL: a month
  2. Rule
    2buy.xyz/wp-
    Cache Level: Bypass, Disable Performance
  3. Rule
    *.2buy.xyz/*cart/*checkout/*my-account/
    Cache Level: Bypass, Disable Performance

Any fürther suggestions on that?

Best regards, Alex

Hello again,

do you or anyone else have any suggestion in this page rule settings to make sure that they will work?

Best regards, Alex