Hello!
I’m building a multi-tenant app using Next.js, hosted on Vercel. The platform allows users to create their own blog and shop, and they can connect a custom domain to it. Everything works fine at first — but there are two key issues I keep running into:
1. “www” Redirect Problem
When a user adds a custom domain (e.g. example.com
) and verifies it:
https://example.com
works fine.https://www.example.com
results in too many redirects.
What I expect:
Ideally, visiting www.example.com
should automatically redirect to example.com
or work as a valid alias. I thought this redirection might be handled by Vercel automatically, but it doesn’t seem to be happening. I’m not sure if I need to do something in the DNS records or add custom rewrites?
2. Domains Lose Verification After Each Deployment
Every time I push an update via GitHub (linked to Vercel), all previously verified custom domains break. Users have to re-verify their domains again even though nothing about their domain setup has changed.
Expected behaviour:
Once a user verifies their domain, it should stay verified — even after updates to the main app. This is causing a bad user experience and extra support work.
Demo / Reproduction
To test it directly:
- Visit https://www.bemushroom.com/ and create an account.
- Add a custom domain to your blog/shop from the dashboard.
- Example live domain hosted on the platform: https://relationshiplabpodcast.com/
(Note:www.relationshiplabpodcast.com
gives the redirect error.)
Project Info
- Platform: Next.js (App directory), deployed on Vercel
- Environment: Production
- Domain Provider: Main platform domain is purchased directly on Vercel
- Custom domains are added manually via the Vercel dashboard
My Questions
- How can I make sure
www.example.com
works properly or redirects correctly toexample.com
without causing a redirect loop? - Why do custom domains need to be verified again after every GitHub deployment? Is there a way to preserve the verification?
Any help or insights would be hugely appreciated. Please let me know if you need more information. Thanks in advance!