Rendering /_error mutates the status code for no reason
See original GitHub issueVerify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Can reproduce on any environment
Describe the Bug
When using Next with a custom server and rendering /_error
, Next changes the res.status to 404 before rendering the page, it’s really odd.
It’s really easy to reproduce https://replit.com/@replitfaris/NextChangeStatusCode, you can fork this and run it yourself
Looks like there’s a report of this behavior going back to 2017 https://github.com/vercel/next.js/issues/2866
Expected Behavior
Maintain res.status
Link to reproduction
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Getting errors 400 and 404 intermittently - Render community
Hi, I'm running a web service through Render that I use as my API for my webapp. (The name of my web service...
Read more >HTTP response status codes - MDN Web Docs - Mozilla
This code indicates that the server has received and is processing the request, but no response is available yet.
Read more >Using WebSecurity.ignoring results in 401 status code when ...
If an error is thrown when handling a request to an endpoint that does not have the Spring Security filter chain applied to...
Read more >How to Fix the HTTP 304 Not Modified Status Code - Kinsta®
The HTTP 304 not modified status code indicates a communication problem between a user's browser and a website's server.
Read more >Handling operation errors - Apollo GraphQL Docs
Apollo Server responds with a 200 status code if resolver errors occurred but the ... and any returned data is cached and rendered...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can do it later, you can also open a PR, here is the file that needs to be edited: https://github.com/vercel/next.js/edit/canary/docs/advanced-features/custom-error-page.md
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.