Add historyRestoreAsHxRequest config to optionally disable hx-request header from history restore requests #3278
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.
Description
This adds a new
historyRestoreAsHxRequest
config item to disable a breaking change made in #2013 where now we returnHX-Request
response header when requesting full page responses which causes many issues for users following our documentation that clearly states to use this response header for returning partial fragments. When returning partials based on this response header without knowing to also check and vary your cache on theHX-History-Restore-Request
header your app will sometimes display the wrong result.This config item is set to default to true to keep the breaking change in place for now so users relying on this behavior will not be impacted and users who need to return partial responses can disable this config as needed.
Corresponding issue:
#3037
Testing
Updated tests to test both states of the config value
Checklist
master
for website changes,dev
forsource changes)
approved via an issue
npm run test
) and verified that it succeeded