Problem excluding files with Cache Rules

Hello there,

After migrating Page Rules to Cache Rules with the help of the Community (i really appreciate the help) now i have a big issue with some of my files in my Wordpress + Woocommerce.

I’ll ennumerate the problems with the files.

  1. I notices that Google Ads is flaging that some of my conversions are not updating ( i send csv file to Google Ads. That means until i clear cache on cloudflare, the files are updating on my server as i can see daily in cpanel. So i test what the problem is.

  2. My Yoast Sitemap is not updating ( same reason ) but this time is .xml file.

  3. For marketplace integration i use CTXFEED ( woocommerce plugin ) and all the files 90% of them are xml file and the 10% is csv file.

  4. For custom integration with 1 ecommerce i need a .txt file and same problem happends here.

I tried to add rules to exclude this files as bypass cache but it’s not working. I tried to copy all the paths of the plugins and they are not working either.

I setup all cache rules as community MVP tells me to do.

Can anyone help me to find out a solution.
Best Regards.

Previous thread is here:
https://community.cloudflare.com/t/strugling-hard-with-cloudflare-migration/659225

Please post screenshots of each of your Cache Rules. As I recall, there were some additional paths you would have to add to your BypassRule.

I don’t think this was mentioned in the previous thread. That would have to be another path to add to your Bypass rule. It might be easiest to use Path CONTAINS .xml for the bypass, so these stay up to date. And you can add another for Path CONTAINS .csv, if that’s the extension for your CSV files.

That would be another path to add to the Bypass rule.

2 Likes

Hi again @sdayman I couldn’t say “thank you very much” in my previous thread because this forum’s system detected my account as spam (a CF member told me that this is a normal situation for new accounts that reply often in the first week). So now i can say Thank you for your help. :slight_smile:

Remembering your name I looked back at the previous thread and realized that you commented that it is not the same OR as AND in the rules so now I have tweaked them, I don’t know if it is correct. (I think it should work now but I’m not sure). See rule called [feed] BYPASS

The system doesn’t allow me to post many screenshots yet so I will post links to the screenshots.

I will start at the beginning. After your first help, my husband and I set about tweaking them according to some other forums and threads on other websites. Right now our cache rules have this order.

Imgur

Rule 1

Imgur

Rule 2

Imgur

Additional questions about rule 1.I don’t know which parameters are correct in edge ttl and browser ttl. The platform is Wordpress + Woocommerce and my products change often. Can you tell me if there is a standard configuration for these 2 additional parameters?

Rule Called: [feed] Bypass

Imgur

This is where i made the changes with AND and OR parameter.

Rule called [BYPASS My accout]

Imgur

This rule bypass the default my account page ( frontend) on wordpress.

Rule 3

Imgur

The ajax function was recommended from our hosting provider. I don’t know why, maybe because of performance, i’m not sure.

Configuration Rules

Imgur

Number 1

Imgur
Imgur

Numer 2

Imgur
Imgur

In this part I have a doubt. Please note that carrito means cart and finalizar-compra means checkout.

On checkout my husband installed checkoutWC. So the user flow is.

example.com/carrito/ then example.com/finalizar-compra/ then example.com/finalizar-compra/#cfw-shipping-method then example.com/finalizar-compra/#cfw-payment-method

In english would be like :slight_smile:

example.com/cart/ then example.com/checkout/ then example.com/checkout/#cfw-shipping-method then example.com/checkout/#cfw-payment-method

So i don’t know in this rule if i need to add the sub-steps or not with " * " symbol. I’m really confused how to use the " / " slashbar and the " * " symbol and when are they needed, if they are only needed in cache rules or if they are needed in page rules or i don’t know honestly.

Finally I would like to ask if there are other cache relays that can help wordpress+woocommerce to run fast, if there is something standard that I can use to benefit from the PRO plan.

Thank you very much again for everything @sdayman :slight_smile:

Since it’s WooCommerce, it’s best to not cache for active shopping carts or logged in users. Only cache for that hostname when these cookies are not present:

These cookie values come from this doc:
https://developers.cloudflare.com/support/third-party-software/content-management-system-cms/caching-static-html-with-wordpresswoocommerce/#cache-static-html-with-cloudflare-page-rules

Rule 2 is fine. Caching uploads is safe, since those are static files.

Rule for Feed/Bypass looks nice. It looks like they finally added the File Extension option, which makes it much easier. (now I’ll have to go back and fix some of my old file extension rules)

Rule for Bypass Account looks safe, since you never want to cache any responses from someone’s account info.

Rule 3 sounds like the one you had before, which is still good.

With the cookie checks in Rule #1, and your new Bypass rules, that should fix most all cache issues.

The config rule to disable performance for wp-admin is ok. It won’t impact user experience to disable features that may interfere with admin.

Disable Rocket Loader for your two paths is fine. Rocket Loader doesn’t make that much of a difference, and it’s better safe than sorry to turn it off for critical areas.

That’s covered by Rule #2, and looks good.

You already have these bypassed for the carrito and finalizar-compra path bypasses. Because you are using “contains”, you do not need any wildcard * in your rules, nor can you use them in Cache or Configuration rules. You should be safe with the / slashes you have, because there should be something after that last slash. I usually don’t put one on the end, just to be sure. You did not put them at the end of any of your Page Rules, so it should be safe to remove them from the ends of your new rules.

I also usually use Path STARTS WITH, but I’m never 100% sure when it comes to other people’s sites.

It’s never easy to get an ecommerce site to be fast for everybody. As soon as they start using a shopping cart, or log in, every page has to come from the server, and not from cache, because the content changes for active users. There aren’t many other features that would result in a noticeable performance improvement.

The only other concern is inventory levels. I don’t think most sites show how much inventory is left, but I think that if you run out of inventory, the item’s appearance on the page should change or be removed. If that page is cached, it might not accurately show availability. You’ll just have to keep an eye on that if that’s something that can happen for your store.

2 Likes

Hello again,

Thank you so much for your help and advices. Now i made the changes as you did. Can you check the SS please? Just to be sure :slight_smile:

Imgur

Yes, that’s perfect. If it’s your site, don’t use cache for users who are logged in are using the shopping cart.

Later on, you’re forcing cache for safe resources in Uploads, and that’s where your site images should be.

One slowdown is the WordPress redirect for /favicon.ico You can replace that with a Redirect Rule to your real icon image (but change the domain name…I’m pretty sure I got the actual icon path correct):

While you’re at it, make another redirect rule for www → apex, because it’s faster to have Cloudlfare do the redirect, rather than the server, just like the favicon redirect above.

2 Likes

Hello again.

I did it exactly as the SS @sdayman

Everything seems to be working properly now. I have purged cache on all sites, on wordpress ( I use autoptimize + perfmatters ) on the server is installed Varnish ( I have cleared cache ) and on cloudflare a total purge. I see no problems and that makes me happy. I’m going to do some test orders and check that everything works from the devices correctly.

I would like to deeply thank you for your help, and above all for the time you have taken to solve these problems.

I hope the solution will help more Cloudlfare users.

Thank you very much from the bottom of my heart.

NOTE: I will mark the result as solved. :slight_smile:

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.