Prevent caching of pages with Stripe form

#1
Greetings,
I have been trying to come up with a solution to prevent pages from caching that have a Gravity form with a Stripe credit card field.

Backstory: I have a lot of clients that use Gravity forms with Stripe addon. These clients have complained about users not being able to complete registration on these forms, wheel just spins, never finishes. I have been able to solve the problem by turning off caching on these pages. I am looking for a solution where my clients don't need to remember to do this. I cannot prevent pages from caching that have a gravity form because all pages have a subscribe form in the footer, so it has to be restricted to forms with a stripe credit card field.

I thought the easiest way might be to look for either a css class or a cookie from Stripe on these pages, but using the check.lscache.io site for testing, the pages are still caching. This is the latest I have added to .htaccess (using the cookie idea):

<IfModule LiteSpeed>
RewriteEngine On
RewriteCond %{QUERY_STRING} !nocache
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/litespeed/$1/index.html -f
RewriteCond %{CONTENT_TYPE} !^text/html [OR]
RewriteCond %{HTTP_COOKIE} site-auth|__stripe_sid
RewriteRule (.*) /wp-content/cache/litespeed/$1/index.html [E=Cache-Control:no-cache]
</IfModule>

Am I doing something wrong, or is there a better way to accomplish this whole task, maybe using setting within LiteSpeed?
Thanks, I am sure this would be useful to others that find this post.
 
Top