Repository navigation
fix(vercel): fall back to request query when ISR header lacks the route param - #4599
Merged
Merged
Conversation
…te param `x-now-route-matches` was the only carrier consulted whenever the header was present, so a header without `__isr_route` skipped the query string that carries the same value.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Warning Review limit reachedNext included review available in 10 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
pi0
approved these changes
Sep 13, 2026
This was referenced Oct 15, 2026
This branch was successfully deployed
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.
Note
AI-generated PR. This change was prepared autonomously by an AI triage agent and has
not yet been reviewed by a human. Review the diff and the reasoning carefully before merging.
On Vercel, an ISR route is served by rewriting
/scheduleto/schedule-isr?__isr_route=/schedule, and the function has to put the original URL back. The value is written into two places: thex-now-route-matchesheader and the rewritten request URL.isrRouteRewriteonly looked at the request URL when the header was absent entirely, so a header that arrives without__isr_routeshadowed the query string that still had the right value. When restoration fails the app renders its 404 for the internal-isrpath, and Vercel stores 404s in the ISR cache.This makes the query string a fallback rather than an either/or. Nothing changes when the header carries the param, and the header-less path is untouched.
x-now-route-matchesis undocumented and has changed shape before (#3539, #3595), which is why relying on it alone keeps biting.Two unit tests in
test/unit/vercel-isr.test.tscover a header with only positional capture groups, with and without extra query params. Both fail onmainand pass here; the rest oftest/unitandtest/presets/vercel.test.tsare unchanged.This is part 2 of the three fixes proposed in #4446. Part 1 there — responding
503instead of rendering a 404 when the URL cannot be recovered from any carrier — is a behaviour decision and is deliberately not in this PR.Part of #4446
🤖 Generated with AI assistant