I recently setup a varnish cache in front of my wordpress instance based heavily on https://gist.github.com/matthewjackowski/062be03b41a68edbadfc. There was a unset req.http.User-Agent; line that was removing the user agent on the contact form post and since the determination of spam uses the user agent it was always returning spam.
I initially thought it was a nonce issue as well. Disabling the nonce with the following in my wp-config.php, did not help.
if ( !defined('WPCF7_VERIFY_NONCE') ) {
define('WPCF7_VERIFY_NONCE', false);
}
@shawnpyle this is exactly what I found out as well! Thank you for the follow up and pointing to the determination of spam for user agent, very helpful. All is working for me now.
I was wondering, what your cache time limits are? Is the nonce still an issue with this resolved? I originally had Varnish set to a 1 week of cache, but after reading (and thinking) that this was a nonce issue, I turned it down to 12 hours. Let me know your thoughts, thanks again!
The cache limits should be a function of how much your content changes. Ours doesn’t change much so we have it pretty long, like a week. I flush the entire cache when there are changes to any page because I don’t really know how to mark specific pages dirty (or didn’t care!).
I’m also using docker containers for these services (caddy for http/s, varnish for caching, wordpress) so purging varnish wasn’t straight forward.
Shawn