Response status code is not 404 but 200 with custom pages/404.vue
See original GitHub issueEnvironment
- Operating System:
Linux
- Node Version:
v14.16.0
- Nuxt Version:
3.0.0-27265876.3cd4494
- Package Manager:
npm@7.17.0
- Bundler:
Vite
- User Config:
-
- Runtime Modules:
-
- Build Modules:
-
Reproduction
https://stackblitz.com/edit/github-tpmisr
Describe the bug
When using a pages/
directory and navigating to non existent page, result is a default nuxt 404 page and statusCode = 404. This is expected
After adding a custom pages/404.vue
page, the content of the page is returned as expected, but statusCode = 200 which is not expected*
Additional context
If this behavior by design, how expected* behavior could be achieved?
Logs
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Vue-router redirect on page not found (404) - Stack Overflow
The solution above would just send you to a 404 page but you are still getting 200 status code. To do this, I...
Read more >Custom Error Pages with nuxt.js - Daniel 'mavrick' Lang
Searching Google for 'custom error page in nuxt' just yeilds github issues that will get you no ... error({ statusCode: 404, message: 'Post...
Read more >How To Properly Serve 404 Errors on SPAs (with SEO in Mind)
In SEO terms, it means that every request will return a "200 Success" HTTP status code. In less technical terms: this is very...
Read more >Generating custom error responses - Amazon CloudFront
CloudFront returns an HTTP 404 status code (Not Found) to the viewer that requested the object. When CloudFront returns a custom error page...
Read more >How to correctly return the HTTP status code 404 for an error ...
... return the HTTP status code 404 for an error page in Nuxt project-Vue.js. ... directly go to the 404 page, you should...
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
@maxdzin @levchak0910 This works for me, effectively setting the right status code (nuxt
3.0.0-27338323.1e98259
)@7ute Great, thanks! I thought that it is supposed to return a
404
error automatically. 😃