Help! Cloudflare caches my WP admin bar

kurosaki4d

Power Member
Joined
Apr 24, 2018
Messages
552
Reaction score
54
Hi,

I am using Cloudflare CDN with my WordPress site.

I noticed a huge mistake, i'm using as a Page rule "Cache everything" in Cloudflare, this makes my page a bit faster, but the problem is that it caches my black admin bar at the top.
When the visitor is inspecting the page, he gets to see the admin bar aswell.

How can i prevent and exclude caching for the admin bar? Is there any way?

Thank you
 

Festinger

Jr. VIP
Jr. VIP
Joined
Feb 27, 2014
Messages
12,613
Reaction score
17,073
Website
festingervault.com
Hi,

I am using Cloudflare CDN with my WordPress site.

I noticed a huge mistake, i'm using as a Page rule "Cache everything" in Cloudflare, this makes my page a bit faster, but the problem is that it caches my black admin bar at the top.
When the visitor is inspecting the page, he gets to see the admin bar aswell.

How can i prevent and exclude caching for the admin bar? Is there any way?

Thank you
first rule:
cache everything

second rule:
Bypass Cache
*example.com/wp-admin/*

third rule:
Bypass Cache
*example.com/wp-login.php*

This is exactly the problem and solution for you here :)
 

kurosaki4d

Power Member
Joined
Apr 24, 2018
Messages
552
Reaction score
54
Thank you very much all for your help, i appreciate it :) i already had setup these two:

first rule:
cache everything

second rule:
Bypass Cache
mydomain.com/wp-admin*

If i add domain.com/wp-login.php* will that remove the black admin bar? Because it doesn't only show on the login page but on all the front pages of the site.
 

Trolling4Dollars

Power Member
Joined
Jun 1, 2016
Messages
740
Reaction score
365
Thank you very much all for your help, i appreciate it :) i already had setup these two:

Set the page rule for wp-admin/* to look like this
Capture.PNG
 

Trolling4Dollars

Power Member
Joined
Jun 1, 2016
Messages
740
Reaction score
365
Thank you so much mate :) I just applied the same things, should i do the same thing to wp-login.php, or was wp-admin alone enough to avoid the issue ?
Personally, I've never applied a page rule to wp-login. Settings I posted above have always done the trick for me
 

kurosaki4d

Power Member
Joined
Apr 24, 2018
Messages
552
Reaction score
54
Personally, I've never applied a page rule to wp-login. Settings I posted above have always done the trick for me

Thank you, i shall give it a try now. Good to know that it worked for you. That's a relief!

Much appreciated mate !
 

kurosaki4d

Power Member
Joined
Apr 24, 2018
Messages
552
Reaction score
54
Ouch, i still have the same problem, i applied the exact rules deleted the CDN cache, and i still get the admin bar at the top in private navigation mode -_-
 

Trolling4Dollars

Power Member
Joined
Jun 1, 2016
Messages
740
Reaction score
365
Ouch, i still have the same problem, i applied the exact rules deleted the CDN cache, and i still get the admin bar at the top in private navigation mode -_-
Are you using Buddypress? Settings > Buddypress > Settings, then the first option is ‘Show the Toolbar for logged out users’. Just uncheck it.

Your theme might be showing it, as well. Check with the theme developer.

Hide it via css:
Code:
#wpadminbar { display:none !important;}

If you've enabled those settings in Cloudflare & truly have a new private window open (meaning, you don't accidentally have another private window already open that has you logged in) there's no reason why you should be seeing it.
 

kurosaki4d

Power Member
Joined
Apr 24, 2018
Messages
552
Reaction score
54
I'm not using Buddypress, since i'm determined to keep the setting "Cache everything" on cloudflare, because it gives me a slight improvement in my loading time, i used your settings and instead of adding the css code, i just disabled the toolbar from the WordPress users page in the backend by unchecking "use toolbar".

This seems to be the best solution combined with your propositions.

Thank you :)
 
Top