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

Custom 404 page returns invalid 404 OK status in server mode #13259

Open
1 task
dralshehri opened this issue Feb 16, 2025 · 0 comments
Open
1 task

Custom 404 page returns invalid 404 OK status in server mode #13259

dralshehri opened this issue Feb 16, 2025 · 0 comments
Labels
needs triage Issue needs to be triaged

Comments

@dralshehri
Copy link

dralshehri commented Feb 16, 2025

Astro Info

Astro                    v5.3.0
Node                     v22.14.0
System                   macOS (arm64)
Package Manager          unknown
Output                   server
Adapter                  @astrojs/cloudflare
Integrations             @astrojs/react

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

No response

Describe the Bug

When using server-side rendering (SSR) with a custom src/pages/404.astro page, the server responds with a 404 OK status code.

This issue occurs in both development and production environments.

The issue can be resolved by explicitly setting the response status in the 404 page:

Astro.response.status = 404
Astro.response.statusText = 'Not Found'

Note: The default 404 page provided by Astro behaves correctly.

What's the expected result?

The server should respond with a 404 Not Found status code when serving the custom 404 page.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-28wvkirt?file=src%2Fpages%2F404.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 Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant