N
Nuxt5mo ago
Mirko

Handling 404 Assets

I currently encounter a problem where nuxt/nitro is responding with SSR on image requests that should return a direct 404. In my pages directory i got a catch-all route. When i now request something like /some-asset.png which doesn't exist in the /public path, nuxt answers with the error.vue (since the slug isn't valid in the application). However i would expect that i can somehow decide if nuxt answers with a page or with a simple 404 response. Is there a point where I can hook into (e.g. server middleware) to catch these image requests, that are not served by /public or /assets and respond with a 404? So probably a Middleware right between nitro asset resolving and nuxt SSR.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server