Caching Advice Needed so Forms are Excluded

By: Mark Hansen | Asked: 03/09/2023
ForumsCategory: General questionsCaching Advice Needed so Forms are Excluded
Mark HansenMark Hansen asked 2 years ago
Thanks in advance for any advice on this topic. 

I have a fairly large site, chock full of images and features, but I have it scoring 100/100 in pagespeed tools and basically, it just flies! That's the good news. 

Every page of the website has one form or another on it for different reasons, and I am seeing issues with conditional forms being cached. 

I've worked around some settings to alleviate some of this, but it's still occurring more often than not, and I really want to fix it without disabling caching at the page level. 

Tech Stack - 

- Nexcess managed hosting. (Bypassed their managed cache for more control) - WP Rocket cache plugin. (Versus Nexcess managed cache) - CloudFlare - All forms with conditional logic use the "Fade in" feature in FP.   At the page level where these forms are loaded, I have eliminated the deferring of scripts and css, so they load on pageload.    Is there a way to assure that forms are not cached?  Again, Thanks in advance for any advice or guideance. Mark
1 Answers
Victor Font answered 2 years ago
I use WP Rocket and add the URLs of mission critical forms to their Never Cache URL(s) list on the Advanced Rules page. By mission critical, I mean the forms I use to run our sites' business operations. I also don't know how using WP Rocket relates to CloudFlare. Does CloudFlare honor WP Rocket's rules? If you're open to researching an out-of-the box idea, there may be some way to add Cache-Control headers to WordPress pages that have Formidable Forms embedded in the content. Every WordPress page is generated on demand. This means you can manipulate the headers. It would take some custom code, but could possibly be handled programmatically with the right WordPress hooks. If the cache-control is embedded in the payload header, every touch point along the delivery route that caches information should honor the header directives. Caching issue feasible permanent solution for mission critical forms. That would make a great add-on for Formidable. Just sayin'... See this: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control.
Mark HansenMark Hansen replied 2 years ago

Thanks, Victor - You're a great resource in this forums and to the community as a whole. I believe WPRocket and CloudFlare work together very well, and have used that combination for a few years with very good success - just using the WPRocket suggested settings from their website.

Like you, I do the same on mission critical forms, bypassing the cache completely on forms that handle API calls and send emails, etc. For the rest of the website, I use simple 1-field forms to gather zip code information and those do fine being cached, since each is unique to the specific page. I do load a small chunk of css for those forms separately though and defer the main FP css. It's only the longer, conditional, forms that seem to be giving me a bit of grief and it's very inconsistent. These forms are also located mid-page, between chunks of content.

I'll dig deeper into Rocket and it's own page level cache-control headers. I appreciate the direction!

Thanks again,
Mark

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right