Custom Domains Need Re-verification After Deployment

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:

  • :white_check_mark: https://example.com works fine.
  • :cross_mark: 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:

  1. Visit https://www.bemushroom.com/ and create an account.
  2. Add a custom domain to your blog/shop from the dashboard.
  3. 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

  1. How can I make sure www.example.com works properly or redirects correctly to example.com without causing a redirect loop?
  2. 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! :folded_hands:

The domain troubleshooting guide can help with most custom domain configuration issues. You might be able to use that guide to solve it before a human is available to help you. Then you can come back here and share the answer for bonus points.

You can also use v0 to narrow down the possibilities.