-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trailingSlash and ERR_TOO_MANY_REDIRECTS on Vercel #10011
Comments
That's a bit generic as an expectation. Since both configurations go in conflict (astro and vercel), which one should win? |
Ah I see what you mean. I guess I'd expect vercel to redirect from |
Or should I remove the trailingSlash config in Astro to let Vercel handle it? |
IMHO, a configuration like this should error and never build, because Astro and Vercel adapter don't know what the user wants, due to conflicting options. Although, I'm not sure if the adapter ever reads |
Okay so after thinking about it, I ended up doing this: const DEV = process.env.NODE_ENV === "development"
export default defineConfig({
trailingSlash: DEV ? 'always' : 'ignore'
}) This way I get a consistent behavior between dev and prod. I think it could be great if the vercel integration looked for a |
That sounds like a reasonable approach to me! I would also add a warning while doing so, because we still don't know which trailing slash is the correct one and users should know that the adapter will use the one option defined in the vercel.json. |
Sorry for digging up an old issue, but I'm confused about some details, maybe someone could help me clear them up? I wanted to set this up exactly like OP mentioned:
So I configured Astro to use Does the Astro config affect more than the dev server, contrary to the docs? I could understand it if the settings were sth. like Astro I must be missing sth., I'd be grateful for any input here 😅 |
Indeed both conflict! In the linked PR, if you are in such situation (in build only I think but not sure), the adapter will warn you and update the astro config to |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Using the vercel adapter, setting
trailingShlash: "always"
(astro config) +"trailingSlash": true
(vercel config) can make some routes to throw aERR_TOO_MANY_REDIRECTS
. For this repro, it happens on the/blog/
page but on another private project I'm working on, it does it for the favicon and sitemap generated urls.https://astro-too-many-redirects-repro.vercel.app/blog/
What's the expected result?
I expect such configuration to not throw this error.
Link to Minimal Reproducible Example
https://github.com/florian-lefebvre/astro-too-many-redirects-repro
Participation
The text was updated successfully, but these errors were encountered: