Next.js Discord

Discord Forum

Using middleware to catch 404

Answered
Capelin posted this in #help-forum
Open in Discord
CapelinOP
Hi, is there any way to catch 404's with the middleware?
Answered by @ts-ignore
You need to manually check if the route exists
View full answer

3 Replies

@Capelin Hi, is there any way to catch 404's with the middleware?
You need to manually check if the route exists
Answer
if you want to run some logic run it in not-found.tsx
CapelinOP
okay, thanks