Trailing slashes on a static Astro site deployed to Vercel: where the redirect actually lives
The author runs a static Astro 7 site on Vercel that serves each page at exactly one URL without a trailing slash. Setting trailingSlash: 'never' in Astro's config does not redirect anything on prerendered pages in production, since the hosting platform handles that behavior. The actual 308 redirects come from the trailingSlash setting in vercel.json, which keeps query strings intact. Testing showed that a separate redirect entry for the slashed form of a removed URL never gets reached, because normalization answers first and creates a two-hop chain. The article also notes that the Astro dev server rejects slashed paths with a 404 rather than redirecting them.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in