• Resolved lowthian

    (@lowthian)


    Greetings,

    This is not an issue so much as looking for an easier method. I posted this on your forumn but was notified you are not using it anymore.

    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 but not other forms.

    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.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support qtwrk

    (@qtwrk)

    if I understand it correctly , you want to exclude a page that contains gravity form , programmatically ?

    if that so , the rewrite rule you posted won’t work

    Thread Starter lowthian

    (@lowthian)

    Not all forms, only forms with a stripe field. We have a form in the footer for newsletter signup, so if we didn’t cache pages with a form it would not cache any page.

    I just have a recurring problem with people not being able to complete a charge, but every time if I turn of caching on that post the form works. Unfortunately my clients don’t remember to turn of caching on the post after adding a payment form, they just let me know the form is not working.

    Plugin Support qtwrk

    (@qtwrk)

    it looks like your issue is not about caching or not

    you have enabled guest mode , but guest mode is not working properly because you blocked this request https://mattiematters.org/wp-content/plugins/litespeed-cache/guest.vary.php which is critical for guest mode to work properly

    please try either disable guest mode , or unblock this request (most likely due to security plugins you have installed, like iTheme)

    Thread Starter lowthian

    (@lowthian)

    Ok, will take a look at that, however that is just the site I sent as an example, I am looking for this solution for multiple sites, I have at least 7 clients that use this combination. Or are you saying this would be a fix for this issue? I typically am using the preset “Advanced (Recommended)” Thanks.

    • This reply was modified 2 years, 1 month ago by lowthian.
    Plugin Support qtwrk

    (@qtwrk)

    you can check above URL to other 7 sites by replace the domain name , make sure they are all works

    and if so , provide me one of the domains that this request works , I will take another look

    Thread Starter lowthian

    (@lowthian)

    Ok, that was a rabbit hole but I finally found a solution for others reading this post, iThemes security does not have a means to whitelist a file, they instead tell you to Disable PHP in Plugins – Security > Settings > System Tweaks > PHP in Plugins

    So @qtwrk that file is now accessable, could you please take a look, thanks.

    • This reply was modified 2 years, 1 month ago by lowthian. Reason: Was inccorrect about previous response
    Plugin Support qtwrk

    (@qtwrk)

    the guest mode looks working on me now

    do you still have issue with the form thing ?

    Thread Starter lowthian

    (@lowthian)

    No, unfortunately that is not the issue. I went to the other sites and all but one was already set up to allow guest.vary.php. So I am still looknig for way to just disable the cache on pages that have the Stripe field. Is it possible for LiteCache to see a class name on the page and not cache it? The stripe class field name is “StripeElement”

    Thanks!

    Plugin Support qtwrk

    (@qtwrk)

    well , the plugin does have API to make a page no-cache

    but in order to call the API , you will need to find out , if the gravity form has API that we can use , to check if there is sripe in it

    Thread Starter lowthian

    (@lowthian)

    No worries, I will just insist that my clients mark those pages to “Disable Cache” was hoping there was an easy way to automate it, but don’t worry.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Caching on forms with Stripe’ is closed to new replies.