Repository navigation
fix: keep Gravity Forms AJAX forms working on long-cached pages - #495
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.phpdidn't cover that:gform_ajax_submission/gform_ajax_validationat 3 days through its owngform_nonce_lifefilter (includes/ajax/class-gf-ajax-handler.php), which overrides thenonce_lifefilter 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.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