Skip to content

fix(@astrojs/vercel): improve internal ISR route handling - #17370

Merged
matthewp merged 2 commits into
mainfrom
vercel-isr-path-hardening
Jul 13, 2026
Merged

matthewp merged 2 commits into
mainfrom
vercel-isr-path-hardening

Conversation

@matthewp

Copy link
Copy Markdown
Contributor

Changes

  • Adds a build-generated token to the internal ISR route rewrite, so the _isr function only applies the x_astro_path path override when the token matches the current build's route table. This replaces the previous x-vercel-isr header check.
  • Strips the internal x_astro_path and x_astro_path_token params from the URL before rendering, so they never reach user code.

Testing

  • Updates the ISR route-generation assertions to expect the new token param (normalized to a placeholder, since it's a random per-build value).
  • Adds _isr entrypoint tests covering the override being ignored without a valid token, ignored when only x-vercel-isr is set, and applied when the valid token is present.

Docs

  • No docs update needed. The token and ISR routing params are internal implementation details with no public API change.

matthewp added 2 commits July 13, 2026 13:27
The ISR route rewrite carries the path token via x_astro_path_token, but
that param was missing from the prerender config's allowQuery. Vercel
strips any query param not in allowQuery before invoking the function, so
the token never reached the entrypoint and every ISR route 404'd. Add the
token to allowQuery and add a regression test asserting every param used
in the ISR rewrite is allow-listed.
@changeset-bot

changeset-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b6eb4d1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 21 packages
Name Type
@astrojs/vercel Patch
@test/astro-vercel-basic Patch
@test/astro-vercel-image Patch
@test/astro-vercel-integration-assets Patch
@test/vercel-isr Patch
@test/vercel-max-duration Patch
@test/vercel-edge-middleware-with-edge-file Patch
@test/vercel-edge-middleware-without-edge-file Patch
@test/astro-vercel-no-output Patch
@test/astro-vercel-prerendered-error-pages Patch
@test/astro-vercel-redirects-serverless Patch
@test/astro-vercel-redirects Patch
@test/vercel-server-islands Patch
@test/astro-vercel-serverless-prerender Patch
@test/astro-vercel-serverless-with-dynamic-routes Patch
@test/astro-vercel-static-assets Patch
@test/vercel-static-headers Patch
@test/astro-vercel-static Patch
@test/vercel-streaming Patch
@test/astro-vercel-with-web-analytics-enabled-output-as-static Patch
vercel-hosted-astro-project Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the pkg: integration Related to any renderer integration (scope) label Jul 13, 2026
@matthewp
matthewp merged commit 3a43cf0 into main Jul 13, 2026
24 checks passed
@matthewp
matthewp deleted the vercel-isr-path-hardening branch July 13, 2026 20:14
@astrobot-houston astrobot-houston mentioned this pull request Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant