-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
custom status code does not seem to be respected in configured redirects #9568
Comments
An interesting thing to check would be to see if it's node specific or if it also happens with other adapters like vercel |
I can replicate it in dev using the stackblitz example, so it's probably an issue in core |
Appears this fix doesn't work in the latest 4.2.4 release. Bit difficult to work out why, as the create.ts appears to have gone through a bit of a rework. |
@Runeloon can you provide a reproduction? |
The reproduction provided here behaves as expected now. If there's still a case where it doesn't work, it would be a distinct issue. |
I did some tests myself and discovered a strange behavior. Astro info:
there is apparently a difference in behavior depending on whether you add a trailing slash ( / ) to the no trailing slash:astro.config.mjs: import { defineConfig } from 'astro/config';
// https://astro.build/config
export default defineConfig({
redirects: {
'/hello': {
status: 302,
destination: '/other',
},
},
}); trailing slash:astro.config.mjs: import { defineConfig } from 'astro/config';
// https://astro.build/config
export default defineConfig({
redirects: {
'/hello': {
status: 302,
destination: '/other/',
},
},
}); Reproduction: |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Configured redirects don't seem to respect a custom status code when provided using an object. using the following configuration:
does not use 302 status code and instead uses 301 status code (the default). I'm in SSR mode, using node adapter.
What's the expected result?
It should redirect me using 302 status code or any other valid custom status code provided in the configured redirect object.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-9cfd3y?file=astro.config.mjs
Participation
The text was updated successfully, but these errors were encountered: