On this page
What this issue is
A nonce (number used once) is a hidden value in a form. The server created it for a visitor and a time window, and checks it on submit. This blocks forged requests, known as CSRF. Some platforms call it a CSRF token or form token.
Page caching saves one copy of the HTML and shows it to everyone. The copy contains the nonce from the moment it was saved. Once the nonce expires (WordPress nonces last up to 24 hours by default, in two 12-hour halves), every visitor who loads the cached copy submits a dead token. The server answers with an error such as 'Security check failed', 'Link expired' or a 403.
- Page cachedCache saves HTML with nonce A
- Nonce expiresServer no longer accepts nonce A
- Visitor submitsOld nonce sent with the form
- Form rejectedError or silent failure
- Lead and trackingNo email, CRM entry or conversion tag
The page looks fine. The failure only appears on submit.
Why it costs you leads or sales
The visitor filled in the form and clicked send, so they were ready to buy or enquire. A rejection at that point loses them. Many will not retry, and some never see a clear error. You also lose the conversion event, so ad platforms see fewer results and optimise on bad data.
It tends to get worse over time. Right after the cache is purged, forms work. As the cached copy ages past the nonce lifetime, more submissions fail. The problem comes and goes, which makes it easy to miss.
Example: illustrative numbers showing acceptance falling once the cached nonce passes its lifetime.
How to check if your site has it
Open the form page in a private window
Use a logged-out session, because many caches skip logged-in users.
View the page source
Search for 'nonce', '_wpnonce', 'csrf' or 'token' in a hidden input. Note the value.
Compare from another browser or device
If the same value appears for different visitors, the page is cached with that token.
Check response headers
In browser dev tools, Network tab, look for cf-cache-status: HIT, x-cache: HIT, x-litespeed-cache: hit or age greater than 0 on the page request.
Submit the form after the page has been cached for a day
If it fails with a security or expired message while a freshly purged page works, the nonce is the cause.
How to fix it
There are two safe approaches. Either stop the form page being cached, or keep the cache and fetch a fresh nonce with JavaScript after load. The first is simpler. Pick the steps for your platform.
Exclude the form page from page cache
In your cache plugin (WP Rocket, LiteSpeed Cache, W3 Total Cache, WP Super Cache) add the page URL to the 'never cache' or 'exclude URLs' list.
Shorten the cache lifetime if you must cache
Set cache lifespan below 12 hours so the nonce is still valid. WP Rocket: Cache > Cache Lifespan.
Check your form plugin settings
Some plugins (Gravity Forms, WPForms, Contact Form 7) offer options to load the nonce or token dynamically. Update the plugin and read its caching notes.
Purge all caches
Clear plugin, server and CDN caches so the old copy is gone.
Send no-store on pages with forms
Add Cache-Control: no-store or private to the response for form pages so shared caches skip them.
Or fetch the token by script
Serve the page from cache and request a fresh token from an uncached endpoint on load, then write it into the hidden field.
Purge the CDN
Clear the cached copy at your CDN after the change.
Know the limit
GTM cannot create a valid server nonce. Fix caching at the server, plugin or CDN instead.
Check form tags still fire
After the fix, use Preview mode to confirm the submit event still triggers your conversion tags.
Native forms need no nonce
Webflow forms do not use a page nonce. If you embed a third-party form, check that provider's cache guidance.
Check any proxy in front
If you added Cloudflare or another CDN, exclude custom form endpoints from caching.
Native forms are handled for you
Shopify forms include their own token and the platform manages caching.
Check third-party form apps
If an app embeds a form with a token, read its docs and avoid putting a full-page cache proxy in front of the store.
Exclude the form from your CDN too
A plugin exclusion is not enough if your CDN caches HTML. In Cloudflare, create a Cache Rule (Caching > Cache Rules) that matches your form page path and sets the action to Bypass cache. Other CDNs have an equivalent path-based bypass rule.
If: URI Path equals /contact/
Then: Cache eligibility = Bypass cache<If "%{REQUEST_URI} == '/contact/'">
Header set Cache-Control "no-store, private"
</If>How to confirm it's fixed
- Purge plugin, server and CDN caches.
- Reload the form page logged out and check the response header shows no cache HIT (or BYPASS).
- Compare the hidden nonce value across two browsers: it should differ or load by script.
- Submit a test lead and confirm it reaches your inbox and CRM.
- Check the conversion tag fires on the thank-you step.
- Repeat the test the next day to be sure it still works after the old nonce would have expired.
Cached form page
- Everyone gets the same saved nonce
- Works after purge, fails later
- Visitors see 'security check failed'
- Leads and conversions silently lost
Form page bypasses cache
- Each visit gets a valid token
- Submissions accepted at any hour
- Leads reach inbox and CRM
- Conversion tags fire normally
How to prevent it happening again
- Keep a list of every page with a form and make sure each is excluded from caching.
- Recheck exclusions after changing cache plugin, theme, host or CDN.
- Add new landing pages to the exclusion list at launch.
- Test submissions logged out, not as admin.
- Test again a day after any cache setting change, because the failure appears only after the nonce ages.
How FunnelGuard handles this
FunnelGuard detects this today. A robot visitor loads your form page as a normal visitor would, fills in the form and submits it on a schedule. When the cached nonce has expired, the submit fails, and the check flags it as 'Submit fails'.
A failure is re-checked from a second region before one alert goes out, by email, Slack, Teams, WhatsApp, webhook or PagerDuty. The alert includes a screenshot and a likely cause. Because the check repeats, it can catch the on-and-off pattern as caches age. Test traffic is marked with utm_source=funnelguard, fg_test=1, an fg_test cookie and its own user agent. The Free plan covers 1 site with 2 journeys and daily checks, no card needed.
Example: 09:00
Cache purged after a deploy. Form works.
Example: next day 10:00
Cached nonce has expired. Real visitors start to fail.
Example: next day 10:15
Scheduled check submits the form and it fails.
Example: next day 10:20
Second region confirms, one alert is sent with a screenshot.
The visitor sends the form and the server rejects the old nonce.
Questions people ask
Why does my form say 'security check failed' or 'link expired'?
The form contains a security token (nonce) that has expired or does not match. This often happens when a cache or CDN serves a saved copy of the page with an old token. Exclude the form page from caching and test again.
What is a nonce in a web form?
A nonce is a one-time or short-lived value that the server puts in a form and checks on submit. It proves the request came from your own page and stops forged submissions. If the value is old or missing, the server rejects the form.
Why does my form work after clearing the cache but fail later?
Right after a purge the page is rebuilt with a fresh nonce. The cache then keeps that copy, and once the nonce expires, submissions fail. Excluding the page from caching removes this pattern.
How do I stop WordPress caching a contact form page?
Add the page URL to the exclude or never-cache list in your cache plugin, then purge all caches. If you use a CDN such as Cloudflare, add a Bypass cache rule for the same path too.
Does Cloudflare cache pages with forms?
By default Cloudflare caches static files, not HTML. If you use a rule or plugin that caches everything, or full-page caching, form pages can be stored too. Add a Cache Rule with Bypass cache for the form path.
Can I fix an expired nonce by making it last longer?
It is not a good fix. A longer lifetime weakens the protection and the cached copy still expires eventually. Bypass caching for the form page or load a fresh token after the page loads.
How can I tell if a cached nonce is rejecting my leads?
Test the form logged out, a day after the last cache purge. If it fails then but works right after a purge, the nonce is likely the cause. A scheduled test submission, such as FunnelGuard runs, can catch this automatically.
Related issues
- OPS-107CDN serving stale page after deployFix guide
- OPS-108Cached page with another visitor's personal data/cartFix guide
- OPS-109Cached logged-in admin bar shown to visitorsFix guide
- OPS-106reCAPTCHA keys wrong domain / expired (form can't submit)Fix guide
- OPS-103WAF rule blocking form submissions with certain wordsFix guide
- OPS-116Rocket Loader / JS optimisation breaking tags or formsFix guide