How can I control the “primary domain” when adding multiple third-party domains to my Vercel project called Virtoura. It’s built using Next.js and using Gel Auth with email/password and Google OAuth providers. I would like www.virtoura.app to always be the “primary domain”.
I’ve noticed that when I add a new third-party domain (e.g., tour.innspace.nl) to my project, it automatically becomes the “primary domain” for the next deployment. Now when users try to signup it results in errors because the allowed redirect URLs for authentication no longer match, as this now uses the tour.innspace.nl instead of www.virtoura.app, which is registered as allowed redirect urls (though nothing breaks until a new deployment is done). The www.virtoura.app domain should remain the primary one, with third-party domains only serving specific paths, for example tour.innspace.nl/show/seo-friendly-project-name for white-label purposes. My clients go through the guided domain verification by putting the CNAME and the custom value in the DNS records of their domain/hosting provider.
Is the above statement/assumption correct? Or might it be related to tour.innspace.nl being the “last added” shortest url? As stated in the docs for the VERCEL_PROJECT_PRODUCTION_URL environment variable?
AFAIK there no concept of a “primary domain” via the Vercel dashboard? I’m looking for a solution to always use www.virtoura.app as the primary domain while being to add third-party domains without breaking auth. Any guidance on dashboard settings or configurations would be appreciated, or could I do this programmatically?
Similar topic explaining the same issue with auth breaking: How to differ between multiple domains in project? #11872
Hopefully I’ve explained it well enough, if there’s any questions please ask!
Separate but associated question: How can I best only allow the path /show/seo-friendly-project-name to be accessed through a third-party domain? All other non-matching paths should redirect to www.virtoura.app. Is this something I can control with a vercel.json and properly configured rewrites section?