Skip to content

fix: keep Gravity Forms AJAX forms working on long-cached pages - #495

Merged
oxyc merged 1 commit into
masterfrom
fix/gravityforms-nonce-life
Nov 16, 2026
Merged

oxyc merged 1 commit into
masterfrom
fix/gravityforms-nonce-life

Conversation

@oxyc

@oxyc oxyc commented Nov 16, 2026

Copy link
Copy Markdown
Member

Kinsta's edge serves pages for up to a year plus 30 days of stale-while-revalidate. Three Gravity Forms lifetimes in web/app/mu-plugins/defaults.php didn't cover that:

  • AJAX submit nonce: Gravity Forms caps gform_ajax_submission / gform_ajax_validation at 3 days through its own gform_nonce_life filter (includes/ajax/class-gf-ajax-handler.php), which overrides the nonce_life filter here. On a page cached longer, an AJAX submit answered "Your session has expired. Please refresh the page and try again.", and refreshing served the same cached page. Logged-out visitors now get 790 days.
  • File-upload nonce: WordPress only guarantees a nonce for half its lifetime (it accepts the current and the previous half-life tick), so 395 days covered only about 197. Now 790.
  • Form state token: checked as a plain age, so 395 days only just equalled the longest serve. Now 400.

Only logged-out visitors are affected: their nonce is shared and comes fresh with any page, so the age limit protects nothing.

🤖 Generated with Claude Code

Gravity Forms caps its AJAX submission nonce at 3 days through
gform_nonce_life, which the nonce_life filter here never reaches, so on
any page Kinsta had cached longer a submit answered "Your session has
expired". Logged-out visitors now get 790 days, as does the file-upload
nonce: WordPress only guarantees a nonce for half its lifetime, so 395
days covered only about 197. The state token, checked as a plain age,
goes from 395 to 400 days to outlast the 1y + 30d serve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oxyc
oxyc merged commit 2591635 into master Nov 16, 2026
1 check passed
@oxyc
oxyc deleted the fix/gravityforms-nonce-life branch November 16, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant