Cloudflare page rules wildcard cache bypass not working

I was having problems logging into WordPress, which was giving me the error:

“Cookies are blocked or not supported by your browser. You must enable
cookies to use WordPress”

Read More

unless I enter “development mode” on Cloudflare.

The Cloudflare docs suggest *example.or/wp-admin*, but this doesn’t catch wp-login, so I’m getting the cookie problems.

So I’m trying *example.org/wp-*in, which I thought should match wp-login and wp-admin.

I put the rule at the top, too, as it is the most specific. The two rules further down are:

example.org/events/* – bypass cache. Seems to be working.

example.org/* cache everything, always on. Again, seems to work.

The only thing I can think is that you can’t use a wildcard in the middle of something like I have, but I can’t find any suggestion that this is the case in the docs, and I can’t add two separate rules as I only get 3.

Thanks.

Related posts

Leave a Reply

3 comments

  1. This is simply a case of missing something so obvious.

    The rule I had was https://example.com/wp-*in but this would clearly not match https://example.com/wp-admin/ or
    https://example.com/wp-admin/edit.php

    The correct rule is, of course, https://example.com/wp-*in*/* and this resolved our problem.

  2. This Solved the problem for me.

    Hi, this morning I had the very same issue when logging on.

    “Cookies are blocked or not supported by your browser. You must enable
    cookies to use WordPress”

    I also found that by logging into cloudflare and entering “development mode” resolved the issue. (Thank you for mentioning this in your original post, it helped me to figure out where to look next).

    Now the only thing I changed yesterday with regards to cloudflare was to one of my Page Rules (main domain page rule).

    The change I made to this section was to the setting for Edge cache expire TTL . Yesterday I had changed this from –Respect All Existing Headers– to –4 Hours-.

    This morning I changed the “Edge cache expire TTL” setting back to –Respect All Existing Headers– and I can now log-in as normal. 🙂

    I hope this helps you too.

    F.Y.I. I use a 3 rule setup for cloudflare.

    Rule#1 = *example.com/wp-admin* 
    Rule#2 = *example.com/*preview=true* 
    Rule#3 = *example.com/*
    

    Basically Rule #1 and #2 bypass the cache for the backoffice and page previews. Rule #3 caches everything else on the website.

  3. This seems strange. Have you opened a support ticket? We really wouldn’t do anything that would trigger this:

    “”Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress””