App for Cloudflare® Pro

App for Cloudflare® Pro 1.9.9

  • Item seller Item seller Shawn
  • Featured

Cache Everything?

gravnetic

New member
At the risk of sounding like a 'normy' what is a guest page? I am trying to optimize my CF page cache rules currently. The main issues I have a re any plugin/page that has a calendar picker, any page with a form (especially a stripe payment in a form) I use Gravity Forms, and Events pages which are mostly the issue RSVP and signup, etc. So what I do now is Cache Everything at the end of a chain of cache bypass rules. Is this the approach you all are taking or recommend?
 
At the risk of sounding like a 'normy' what is a guest page? I am trying to optimize my CF page cache rules currently. The main issues I have a re any plugin/page that has a calendar picker, any page with a form (especially a stripe payment in a form) I use Gravity Forms, and Events pages which are mostly the issue RSVP and signup, etc. So what I do now is Cache Everything at the end of a chain of cache bypass rules. Is this the approach you all are taking or recommend?
Guest pages are are the HTML pages rendered for people not logged into an account on your WordPress setup. They are a little different because logged in users have parts of the page unique to them (for example showing their avatar or username they are logged in as). Guest pages are able to be cached at the network edge (Cloudflare data centers) because they don't contain info unique to a user who's logged in.

Honestly, Cache Everything tends to cause problems becuse well... you are caching everything without any sort of logic. Personally, I would never use a rule that had a Cache Everything directive on any of my sites. Like I said, it tends to cause problems. You are better off using actual logic to decide what gets cached. This plugin creates a Cache Rule that makes everything Eligible for cache, but that doesn't necessarily mean everything IS cached. It just allows server-side logic to be used to make the decisions about WHAT is and isn't cached.

TL;DR: Cache everything is more or less a lazy way to do it (doesn't use an logic for making decisions if something should be cached or not), and tends to cause problems since it blindly caches everything.
 
This makes sense, but also by using bypass rules it catches more cache opportunities. I honestly, just need to figure out an approach and impliment this which is actually quite difficult with dynamic WP sites. Any resources you can recommend? I like the rules you apply and they do make sense. My approach is the lazy way, but I also wonder what the ideal approach is for a WP site that have Admin (logged in users), Woo, Events, Login, Forms, etc.
 
What exactly isn’t working as expected if you enable the Guest page caching within the plugin? I’d rather address whatever isn’t specifically working in your setup rather than reinvent it from scratch (again).
 
Gravity Forms has a support document more or less saying you can never cache it’s pages:


Probably similar with Stripe (and other payment processors). If you are letting guests (people without accounts) make payments, you’ll probably want to blacklist a set of URIs to not be eligible for cache. That’s going to be the simplest solution (for now). Will also look into seeing if there’s a way to automatically detect those pages to make it automatic.
 
I am trying to figure out a cookie or header to bypass the cache on pages that have a form.
I do not want to cache them, but they are cached currently. This is also not a bug or issue with your plugin, caches are complex.
 
If you edit the wp-content/plugins/app-for-cf/src/DigitalPoint/Cloudflare/Base/Pub.php file, and change this:
PHP:
$cloudflareAppOptions = $this->cloudflareRepo->option(null);

...to this:

PHP:
if (is_plugin_active('gravityforms/gravityforms.php') && !empty($GLOBALS['post']) && $GLOBALS['post'] instanceof \WP_Post && has_shortcode($GLOBALS['post']->post_content, 'gravityforms'))
{
    $noCache = true;
}

$cloudflareAppOptions = $this->cloudflareRepo->option(null);

Does that sort out the Gravity Forms issue for you? I don't have access to Gravity Forms, so I can't test it myself, but in *theory* that might work.

Basically it's looking to see if Gravity Forms is installed and if it is, check if the current page has Gravity Forms shortcode on it. If it does, make the page not-cacheable (even for guests).
 
Back
Top