fix: collapse 742 trailing-slash redirect pairs to reclaim Vercel route headroom - #532
Conversation
vercel.json held 744 pairs of redirects that were byte-identical apart from the trailing slash, with the same destination and status code. Each pair costs two of the 2048 routes Vercel allows per deployment, and main had been sitting close enough to that ceiling that ordinary PRs were failing to deploy (see 27380fd and the fix on #503). Collapse each pair into one rule using the ':path(.*)'-adjacent '(/?)' suffix, which matches both the bare path and the trailing-slash form. redirects: 2029 -> 1287 config routes: 2034 -> 1292 (cap 2048) Behavior is unchanged. Vercel matches redirect sources literally: a with-slash-only rule 404s the no-slash form and vice versa, verified against production on /agent-platform/capabilities/web-search and /agents/using-agents/model-choice. The '(/?)' form was verified on a preview deployment to match both forms while staying anchored, so '/xextra', '/x/deeper', and '/prefix/x' all still miss. Two safety guards: - Only plain-literal pairs with identical destination- Only plain-literal pairs with identical destination- Only plain-litar- Only plain-literal pairs with identical destination- Only plainsting the with-slash form up to the position of the no-slash form could jump it ahead of a wildcard that currently wins. Any pair with a rule betw wildcard that currently wins. Any pair with aorm is s wildcard that currently wins. Any pair with a rule betw wildcard tund /errors/:code and /university/(.*) and are left as-is. Equivalence is proven rather than assumedEquivalence is proven rather thhe original file resolve to the same destination before and after. Co-Authored-By: Warp Agent <agent@warp.dev>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR collapses duplicate trailing-slash redirect pairs in vercel.json into single (/?) sources to reduce Vercel route usage without changing page content or navigation. I validated the attached diff by reconstructing the resulting config, parsing the JSON, checking redirect/source counts and uniqueness, and simulating the changed literal redirect paths for old-vs-new status/destination equivalence.
Concerns
- No blocking concerns found.
- No approved or repository spec context was available for implementation drift review.
- No added or changed comments/tests were present in the diff.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
Summary
vercel.jsonheld 744 pairs of redirects that were byte-identical apart from the trailing slash, with the same destination and status code. Each pair burns two of the 2048 routes Vercel allows per deployment.That ceiling has been a recurring problem:
27380fdfcollapsed the/cliredirects to get under it, and #503 failed to deploy for the same reason and needed its own fix. main has been sitting close enough to the cap that ordinary PRs adding a redirect could not deploy.Collapsing each pair into a single
(/?)rule takes the file from 2034 to 1292 config routes.Why both forms need a rule today
Vercel matches redirect sources literally — there is no trailing-slash normalization. Verified against production:
/agent-platform/capabilities/web-search/)/agents/using-agents/model-choice)So the duplication is not redundant today. It is the only way to cover both forms — until one rule can do it.
The pattern
/path(/?)matches both/pathand/path/. This uses the same unnamed-regex-group support the repo already relies on for/university/(.*).Verified on a preview deployment, at small scale first and then on this branch:
Safety
Two guards in the transform:
/errorsand/university, which sit around/errors/:codeand/university/(.*)— and they are left uncollapsed.Validation
Locationheaders.npm run build— clean.Follow-up, not included here
There are 53 retired paths whose no-slash form 404s today because only a with-slash rule was ever added. This PR does not change that behavior either way — collapsing only touches paths that already had both forms. Worth a separate pass now that there is headroom to add rules again.
Unverified claims
None. This changes only redirect routing config; no page content, slugs, or navigation are touched. Every behavioral claim above was checked against a live deployment rather than inferred from the config.
Co-Authored-By: Warp Agent agent@warp.dev