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

Atro Build: 404.Astro only handles paths with the pathname https://example.com/404, rather than all non-existing paths. #9854

Closed
1 task
karannakra opened this issue Jan 28, 2024 · 0 comments · Fixed by #9907
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@karannakra
Copy link

karannakra commented Jan 28, 2024

Astro Info

Astro                    v4.2.6
Node                     v18.18.2
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/react

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

No response

Describe the Bug

Create 2 pages

  1. 404.astro
  2. index.astro

Now, try entering a path for a page that does not exist. In development mode, 404 handles all unknown paths. However, while running with Astro preview, only 404 is captured.

The 404.astro page only captures routes with the pathname 404, although it should capture all pathnames for which the path does not exist. It was working great in Astro 3. When I switched to Astro 4, this fault appeared.

Steps to reproduce the bug

  1. Run astro build
  2. Run astro preview
  3. Go to some unknown path

What's the expected result?

404 should catch all pathnames to pages that do not exist. It works properly in development mode. It does not work after astro build and astro preview.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-vf7clf?file=src%2Fpages%2F404.astro,src%2Fpages%2Findex.astro

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 Jan 28, 2024
@karannakra karannakra changed the title After building the app, 404 is catching the localhost:4321/404 path rather than all not available paths. Atro Build: 404.Astro only handles paths with the pathname https://example.com/404, rather than all non-existing paths. Jan 28, 2024
@lilnasy lilnasy added - P3: minor bug An edge case that only affects very specific usage (priority) and removed needs triage Issue needs to be triaged labels Jan 29, 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

Successfully merging a pull request may close this issue.

2 participants