serverless-nextjs / serverless-next.js

⚡ Deploy your Next.js apps on AWS Lambda@Edge via Serverless Components
MIT License
4.45k stars 455 forks source link

Have unmatched routes fallback to nearest not-found #2598

Closed dbrxnds closed 1 year ago

dbrxnds commented 1 year ago

Is your feature request related to a problem? Please describe. As far as I can tell it's currently only possible to have unmatched routes render the root not-found page. I think it would be better (if possible) to render the nearest not-found page. Our use-case is that we have an "admin" and a "regular" side in our product. The 404 page in the admin should reflect the admin, and the same goes for the regular side.

Describe the solution you'd like Have unmatched routes render the nearest not-found rather than the root

Describe alternatives you've considered I think it may be possible to achieve this by using route groups, but that does not seem ideal