Troubleshooting Cloudflare and WordPress

Troubleshooting Cloudflare and WordPress

Early 2021

Description

I decided to try Cloudflare’s CDN service for my self-hosted website to improve its page speed and performance.

The Cloudflare help center and forum were helpful, but sometimes difficult to follow. I still ran into problems after following their WordPress help pages. Also, I chose not to install a Cloudflare plugin as I was trying to keep my plugins to a minimum.

These are a few problems that I found simple solutions to after several rounds of research and troubleshooting.

Skills

What I have learned from this process:

  • Problem-solving skills
  • Research with checking out relevant forums and communities
  • Structuring which problem to tackle first
  • Revising and testing live changes several times for reliability

Error #1: Can’t Access Login Page

It can be incredibly frustrating when you can’t access your WordPress login page. A blank, white screen appears or you get an error message saying that there have been “too many redirects” to the login page.

Solution

After reading a few help articles from different sites, I narrowed it down to a plugin setting.

My security plugin had enabled automatic redirection from a long time ago, which I had forgotten about.

Disabling the redirection helped me access my login page as normal.

cloudflare_wp_signin

Error #2: Setting Up Page Rules

I use site performance testers like GT Metrix when looking for ways to optimize a website.

The warnings like “leverage browser caching” were alien to me at first. I noticed that my site was slower after setting it up at Cloudflare.

How could this be when a CDN is supposed to improve site speed?

Solution

After reading articles like Cloudflare Page Rules and Page Rules for WordPress, I understood that my page rules probably needed a bit more tweaking. I set up the caching levels in the three page rules you’re allowed under the free plan.

Following this sequence and the cache levels / cache rules helped bring my site’s page speed to a much more reasonable and acceptable level.

Error #3: Admin Bar Showing When Logged Out

I noticed that my WordPress admin bar was showing on all pages even after I’d logged out. This is distracting as it looks like a permanent error that your website displays right at the top of the screen.

Solution

I found that this sequence helped keep the admin bar from being visible, after the page rules had been set up as outlined in the previous section.

  1. Sign onto Cloudflare
  2. Enable “Development Mode”
  3. Log into WordPress
  4. Make website changes
  5. Log out of WordPress
  6. Disable “Development Mode” on Cloudflare
  7. Sign out of Cloudflare

This screenshot shows the “Development Mode” button enabled in Cloudflare.

Cloudflare: Development Mode “on”

This mode temporarily bypasses the cache on WordPress for three hours (or until you disable the feature).

With this enabled, I logged into WordPress, made my updates, and signed out of WordPress. Then I went back to my Cloudflare window to turn off development mode.

A quick check on my browsers on the PC and iPad (and in incognito mode) showed that the admin bar was no longer appearing.

Cloudflare: Development Mode “off”