Home

Issue: 3113

How to trigger error from the server manually?

[issue link]

Hello guys

This is a question partly concerning a web server (Node/Express in my case) running statically generated Nuxt app. Asking this here instead of SO thinking that this could go into the documentation later on.

Nuxt has a mechanism to detect errors such as 404 and redirect the app to a layout/error (if it exists)

Can this behaviour be triggered manually by the server? For example, if the user is unauthorized, the server wants to send a 401 response and expects nuxt client (running statically) redirect to error layout.

Is this possible to do with headers? How does nuxt detect an error if it’s not SSR’d?

Thank you!

This question is available on Nuxt.js community (#c2696)