• Resolved narratorben

    (@narratorben)


    Hi, I seem to have an issue with AJAX, the issue presents on a couple of sites.

    The site linked above has gravity forms, wherever these are submitted via AJAX I get a 405 method not allowed error, I run WP Rocket and if I turn off either Rocket or Cleantalk the forms submit fine so it seems to be a glitch between the two of them. I spoke to WP Rocket who advised that I speak to you so I was wondering if you have any insight.

    I run Cleantalk with Spam Firewall off as that causes lots of problem with caching, I’m fine with those but I’d like to have the form protection on and ideally page caching too so I was wondering if this is a known issue. I’ve tried following your caching guide and have implemented all of the recommendations there but I still have problems.

    I have another site with a similar setup that gives a 405 error on WooCommerce ajax add to cart functions so it appears to be to do with Ajax and caching.

    Thanks

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support sergecleantalk

    (@sergecleantalk)

    Hello,

    There are no known conflicts with WP Rocket. For further investigation, please contact us through our private Ticket System:

    https://cleantalk.org/my/support/open

    Thread Starter narratorben

    (@narratorben)

    Thanks, I have opened a ticket referencing this case.

    Plugin Support sergecleantalk

    (@sergecleantalk)

    We received a CleanTalk ticket #52744 from you. Let’s continue there.

    Plugin Support amagsumov

    (@amagsumov)

    Hello,

    In case others are experiencing the same issue, here are the results of our investigation:

    We have conducted several tests and can confirm the cause of the 405 error.

    The error occurs specifically when WP Rocket is enabled. WP Rocket is caching the page as a static file. When a form submission tries to send a POST request to this static file, your Nginx server correctly responds with 405 (Not Allowed), because static files are not meant to process form data. You can see this Nginx response clearly in your screenshot.

    This is a known, long-standing issue. As confirmed in the community discussion we reviewed, https://community.wordops.net/d/277-nginx-error-405-with-wprocket-config/21, this problem has persisted for over four years with specific configurations of WP Rocket and Nginx.

    The quick and correct solution is: exclude the specific page URL(s) from WP Rocket’s caching and optimization settings. This prevents the page from being cached as a static file, allowing POST requests to reach WordPress and be processed normally.

    Our recommendation, besides adding an exclusion, is to contact WP Rocket Support. You should mention that your setup also uses Redis Object Cache, as this can sometimes influence caching behavior.

    Thread Starter narratorben

    (@narratorben)

    I have actually found that it is a little more nuanced than that.. Wordops NGINX setup has specific rules for WP Rocket, it is these rules not Rocket itself that are causing the issue because they bypass some of the WP Rocket logic and directly serve the cached HTML files.

    You can disable the Wordops WP Rocket config and instead use this one https://github.com/SatelliteWP/rocket-nginx#installation those rules allow you to keep WP Rocket active without breaking AJAX.

    Thanks to Cleantalk support for pointing me in the right direction to discover that!

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.