Cloudflare cache problem - need help


After logging in, even if you’ve entered the right credentials, you’re still not connected. You have to try once more to get it to work.
The same goes for logging out: the site displays the question ‘Are you sure…’, you confirm and see ‘You are now logged out’. But according to what’s displayed - you’re still logged in. And you have to start again.
In fact, when I refresh the page manually after the first attempt, to log in or out, the site immediately displays the correct situation, no need to repeat.
Obviously, this is very disconcerting for the client, who of course won’t refresh manually-).

But: when I set Cloudflare to Development Mode, the log in and log out action works perfectly on the first try.

What method/setting should I use?
Thanks in advance for your help :slight_smile:
Music Bay

It sounds like you created a cache rule that’s not compatible with your site. You’d have to disable it until you can figure out which parameters to use.

Most likely, your site uses cookies to track sessions, and your rule should not apply when the cookie is present.

Hello, thanks for your reply.
Yesterday we set up a rule to bypass wp-login. But that was to solve another problem - this rule solved it but not the problem from my post.
This problem therefore predates this rule.
Is there a solution/rule that helps the login page to refresh automatically? Or another method? Just a reminder- in Development Mode everything works - thank you-).

You shouldn’t need such a rule. Cloudflare does not cache wp-login by default.

Right, because you’ve set some sort of rule that’s caching what it shouldn’t.

Without this rule, we always got the message: Error: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.
Since yesterday - that is, since this rule was introduced - the cookie problem has never reappeared. On the other hand, the fact of being “forced” to log in and log out twice is still there).

As I said above, this problem was there before this rule was introduced.

I see that you’re using APO, but that should exempt logins and any other user-based activity from caching.

It looks like the shopping cart software you use is not using cookies that APO recognizes. The list is here:

For example, if I add an item to my cart, then go to the home page, my cart is empty. Looking at my requests, it includes cookies unique to your shopping software, such some stripe cookies.

You may want to experiment with a Cache Rule that sets BYPASS if certain cookies are present. This may take some trial and error as you find out which cookies are key to the issue.

Yes, I opted for APO a long time ago, and I’ve never noticed any problems.
The purchase process goes very smoothly, there are no problems. Not with cookies or anything else.
The only problem we have is that we have to repeat the log in / out action twice for the status (‘connected’ or ‘disconnected’) to be correctly displayed.
In reality, after the first action, e.g. log in, when I refresh the page manually - everything is already correct. But of course I can’t ask clients to do it manually-). It looks like the page refresh isn’t happening properly, something in the cache is blocking it.