-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 has status code 200 OK #7516
Comments
Perhaps any updates on this topic? For SEO reasons, this is quite an annoying bug that I haven't been able to find an easy solution for... |
Will look into it |
@xriter , The 200 status code is returned only in development, but I can see the 404 status code when building with the node adapter. Is your issue related only to the development mode? |
@ematipico You are right. It appears to be correct in the production mode. Only in development mode it gives the unexpected |
Yeah it's a bug, we'll have to look into it. |
Taking a look at this one now! Once #7693 is merged it should be a straightforward fix. |
* chore: update tests * chore: update tests * fix(#7516): set response status to 404 when rendering 404 page * chore: add changeset * chore: update dev container test * refactor: improve status handling logic * chore: remove unused import
Hi, the issue is still here. In Dev mode, it returns a 404, but after the build it's 200. |
What version of
astro
are you using?2.7.0
Are you using an SSR adapter? If so, which one?
Node
What package manager are you using?
npm
What operating system are you using?
Mac
What browser are you using?
Safari
Describe the Bug
I created a custom 404 page (following the docs: https://docs.astro.build/en/core-concepts/astro-pages/#custom-404-error-page).
But when hitting this page, the status code of the document is still 200 OK!?
404 Not Found is expected.
(Use the web inspector to see this.)
Note that the logs of Astro ARE logging 404 though. Is the status code of the page even set by Astro?
What's the expected result?
Status code 404
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-xjlmoy?file=src%2Fpages%2Findex.astro
Participation
The text was updated successfully, but these errors were encountered: