Different TLDs rather than subdomain for branch

I’m trying to confirm whether the following setup is possible in one Netlify site, or if it requires two totally separate sites:

www.example.com - “main” site, master/main branch
www.example-dev.com - dev branch

The reason I need them to be different TLDs is because of (relatively) recent SameSite cookie changes. That is, each site hits a backend API at the ‘api’ subdomain, and in order to share cookies the domain on those cookies needs to be the TLD.

Of course, I want www.example.com and api.example.com to share cookies - but if I then create e.g. dev.example.com and api-dev.example.com, dev and prod start mixing cookies and sadness ensues.

I might be missing something in the docs, but I can’t seem how to make this happen - sites seem to require a subdomain. Is that in fact the case, or is there some way to make this work?

(NB: the branch doesn’t have to be dynamic for my use case - a static ‘dev’ branch is totally fine).

You can put as many names as you want in place on a site, but they won’t be able to serve different branches.

For your use case, I’d suggest two separate sites; make the dev branch the “production” branch on site 2, turn off other branches from building (so as not to duplicate work from your main site), and apply the name example-dev.com to it. You can link as many sites as you’d like to the same repo, in most cases here :slight_smile: