CloudFlare

Fixing WordPress Admin Issues with CloudFlare Page Rules 15


I’ve been noticing some wonkiness with the admin area of our WordPress blog at CheatCodes.com EXTRA!. Through some experimentation, I noticed that all of the issues went away if I put CloudFlare into Development Mode. This, however, isn’t a long-term fix, so I decided to create a CloudFlare Page Rule for the /wp-admin/ directory. To do this, just login to CloudFlare and create a Page Rule that covers:

http://example.com/wp-admin/*

Then turn off EVERYTHING: apps, cache, security, always on, etc.

This fixed most of my problem, but I noticed that I still had issues when logging in or out of the WordPress admin area, and I couldn’t figure out why.

Then it hit me – the login page for the WordPress admin area isn’t in the WordPress admin area, and therefore wasn’t covered by my CloudFlare Page Rule! Instead, the WordPress login page is here:

http://example.com/wp-login.php

So I added a second page rule that covered:

http://example.com/wp-login.php*

The asterisk is necessary to cover URLs such as:

http://example.com/wp-login.php?loggedout=true

Now the login/logout hangs and other strange behavior are gone, my WordPress admin area works great for all our authors, and I’m still benefitting from CloudFlare protection and optimization across the rest of the blog.

So if you’re noticing strangeness between WordPress and CloudFlare, create a Page Rule!

  • http://tipsfromgeek.com Bhavyesh

    Thanks mate, was facing this issue recently.. hope this will solve the problem :)

  • http://www.facebook.com/mark.bloglines Mark De Scande BlogLines

    Thank you for saving me some time :) Your a ROCK Star

    ‘http://thisnetwork.co.za/wp-login.php*– no cache — no options’

    This seems to works on my Multi Site install

    Just thought i would let you know

    • http://www.stevejenkins.com/ Steve Jenkins

      Glad to hear it also worked for you! :)

  • Damien Power

    Thank you, sir! This was shaping up to be a real nightmare, and your two lines of rules made my day!

    • http://www.stevejenkins.com/ Steve Jenkins

      Great to hear. I wish CloudFlare would put this in their knowledgebase!

  • Al

    Hi,

    If I all understand (sorry for my english)
    With 3 rules

    1 http://example.com/wp-login.php* -> no cache
    2 http://example.com/wp-admin/* -> no cache
    3 http://example.com/* -> agressive cache

    My website is working well without admin access problems ?

    • http://www.stevejenkins.com/ Steve Jenkins

      Salut, Albert, Oui, vous avez bien compris le blog post. Ces trois règles en CloudFlare devraient résoudre votre problème.

      • Al

        Thanks/Merci 😀
        for your quick answer !
        and your good french 😉

        • http://www.stevejenkins.com/ Steve Jenkins

          C’est rien (et j’ai vécu en France pendant quelques ans) :)

  • http://www.megganmamma.com megganmamma

    Thanks Steve, Have been shut out from my site on a few occasions by cloudflare – love that I don’t need to think about putting cloudflare into development mode anymore (I always forget).

    …Now if you happen to have any idea why why the caching on my site (cloudflare / wp super cache) seems to periodically serve up the mobile theme on my desktop home page or conversely the desktop theme on a mobile device, you’d have a fan for life.

    In either case, grateful for finding this post whilst searching for other answers.

  • John

    Thanks so much,

    This solved an issue for me as well, having to do with a setting in the Clean Login plugin…

  • http://adebold.wordpress.com Adrian

    Thanks for this post, Steve.

    One question for clarity. You say to turn off everything, including security. I understand the others but would be concerned about turning off security. Doesn’t that leave ‘Admin’ open?

  • http://www.talkwards.com Erik

    Have you tried to run the rules with security on? I’m thinking that if there’s any place I’d like Cloudflare security, then it’s in the login/admin pages…

  • http://jonegerton.com Jon Egerton
  • http://drakeportal.com julian

    Thank you very much, had this issue when I disabled object and database cache under W3 total cache, since I’m on a shared host.