Dynamic Subdomain Support in Nuxt3
I'm working on implementing dynamic subdomain handling in Nuxt by using a router.options file, as described in this article https://zernonia.keypress.blog/why-keypress. However, I'm facing an issue where the platform page doesn't render correctly when a user visits it through a subdomain, it shows the error
404 page not found: /
.
I rather don't want to use the nuxt-multi-tenancy package.
https://github.com/hieuhani/nuxt-multi-tenancy
3 Replies
I've fixed this problem by changing the (replace) path param name, example:
.../:platformUrl
should be .../:platformUrl()
@patchamamma I was facing the same issue and ended up doing the same.
After this change, have you tried to pre-render subdomain pages? I see an issue, where it is okay to pre-render all the pages for Nuxt project, but not the subdomain pages.
@Alex I'm not planning to pre-render my project, but I did try it, and it works, as long as I’m not using dynamic data based on the subdomain. For example, if I try to return a 404 error when a vendor cannot be found, like this:
this will of course result in an error during the
npx nuxi generate
process.