Skip to content
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

manual i18n routing not working with prerendered 404 page #10785

Open
1 task
stefanprobst opened this issue Apr 13, 2024 · 0 comments
Open
1 task

manual i18n routing not working with prerendered 404 page #10785

stefanprobst opened this issue Apr 13, 2024 · 0 comments
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@stefanprobst
Copy link

Astro Info

Astro                    v4.6.1
Node                     v20.12.2
System                   Linux (x64)
Package Manager          pnpm
Output                   hybrid
Adapter                  @astrojs/node
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

with the recently added manual i18n routing strategy, and this middlwware, i want to redirect the "/" root route to the default locale "/en".

in a production build, when the src/pages/404.astro file has export const prerender = false, i get the expected 307 redirect. however, when 404.astro has export const prerender = true i get a 404.


to reproduce:

  1. git clone git@github.com:stefanprobst/issue-astro-i18n-manual.git && cd issue-astro-i18n-manual && pnpm install
  2. pnpm run build
  3. pnpm run preview
  4. curl -i http://localhost:3000 which prints: "HTTP/1.1 404 Not Found"

now, change the prerender mode in 404.astro to false:

  1. sed -i "s/prerender = true/prerender = false/" src/pages/404.astro
  2. pnpm run build
  3. pnpm run preview
  4. curl -i http://localhost:3000 which prints: "HTTP/1.1 307 Temporary Redirect"

What's the expected result?

root route "/" should be redirected to default locale "/en" when 404.astro has export const prerender = true (or with output: "hybrid").

Link to Minimal Reproducible Example

https://github.com/stefanprobst/issue-astro-i18n-manual

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Apr 13, 2024
@matthewp matthewp added - P3: minor bug An edge case that only affects very specific usage (priority) and removed needs triage Issue needs to be triaged labels Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

2 participants