nuxt-modules / i18n

I18n module for Nuxt
https://i18n.nuxtjs.org
MIT License
1.71k stars 478 forks source link

fix: `statusCode` in `rootRedirect` not working with strategy 'prefix' #2785

Closed BobbieGoede closed 7 months ago

BobbieGoede commented 7 months ago

šŸ”— Linked issue

ā“ Type of change

šŸ“š Description

Resolves #2758

I think the rootRedirect.statusCode was ignored because the request was redirected twice, once from / to the configured rootRedirect.path (e.g. about) with the statusCode, then again because /about doesn't exist for strategy prefix so it will be redirected to /en/about while ignoring rootRedirect configuration, as it's no longer redirecting on root.

This PR changes rootRedirect to try and translate the redirect path, so that a single redirection happens with the configured status code.

šŸ“ Checklist