I'm building a SaaS and need to offer my customers the ability to have their own domains/subdomains pointed to their personal pages. That can easily done on Vercel.
However I'm not sure how to handle it in NextJS, I'm thinking of creating a [slug].js file for domains/subdomains and then rewrite from next.config.
Is that the proper way to handle it or is there a better way? Has anyone done this?
Thanks!
Edit: forgot to add that I'm using getStaticProps and I need to generate a static page.
I think you can just use 'getServersideProps' and render depending on the host name that should be provided somewhere in the request object: https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering