Open wotschofsky opened 6 days ago
I don't think this is a bug, our redirects, by design, aren't meant to handle external redirects:
https://github.com/withastro/roadmap/blob/main/proposals/0041-redirects.md#non-goals
This means that if you need to handle external redirects, you'll have to use - most probably - vercel.json
I see, wasn't aware of this. Given that the Cloudflare adapter supports external redirects, I was assuming external redirects should be supported.
But if the platform supports external redirects, why not allow them to be configured adapter-agnosticly through the Astro config?
Because Astro doesn't know which platform you will use, and that's where the adapter comes into play. We could consider e feature request for the Vercel adapter, it that's doable
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Redirects defined in
astro.config.mjs
are improperly transformed by the Vercel adapter during build, making it impossible to redirect to an external URL.Example:
https://google.com
->/https:/google.com
The adapter always runs the redirect destination through Node's
path.join
while prepending the projects base path (usually/
). Therefore external redirects are "destroyed" and converted into local redirects like shown above.The final redirects for deployment are defined inside of
.vercel/output/config.json
See https://vercel-redirect-repro.vercel.app for deployed example
What's the expected result?
Automatically detect external redirects, for example based on whether a protocol is defined, and skip any transformation logic to preserve the original redirect
Link to Minimal Reproducible Example
https://codesandbox.io/p/devbox/hopeful-scooby-cpzf5m
Participation