Dynamic 404, 500 and _error page support #29
Unanswered
joriregter
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm happy to see that Next.js and Vercel are starting to support multitenant applications. At my office we have been building multitenant applications for quite a while, but Next.js middleware features opens up a lot of new possibilities. We've been investigating how we can leverage the middleware features for multitenant websites, without losing any other features. However, there are some features that seem quite a hassle to pick up.
Dynamic 404, 500 and _error page support
In a regular Next.js project you can add 404, 500 and _error pages to the root of your project. Automatically, all traffic that should end up here is rewritten here by Next.js.
The 404, 500 and _error pages have no context of the previous request whatsoever apart from the current active language.
Usually, this is fine, because we can use the regular i18n setup and regular environment variable setup to make sure we resolve the correct dynamic content (such as a navigation or load the GTM scripts for the correct GTM ID).
Though, in the multitenant project, the context of the previous request that triggers the 404/500/_error is incredibly important, because we need it to determine the active language and determine the correct environment variables in order to resolve this dynamic information on these pages.
Right now, it seems like there is no way to create a dynamic tenant-unique 404, 500 or _error page without either:
Are there any ideas or suggestions as to how to tackle this issue?
Beta Was this translation helpful? Give feedback.
All reactions