Preview Deployment Suffix with a .dev and .com production domain

This post/question is a bit of a brainstorm session jotted down.

My setup:

acma.dev → acts as the latest main deployment for testing and previewing (our tester test on this domain)
*.preview.acma.dev → all preview deployments are on this domain
acma.com → our actual production domain.

Currently if we promote a build to staged production that build will be made available on “acma.com-preview.acma.dev” So now we have a produciton build on our .dev domain, mixing up the cookies we have already set for our .dev environment.

(staged) Production builds should be on our .com domain and preview builds should be on our .dev domain to not mixup cookies.

How do other people fix this issue?

I have to idea’s how this potentially could be solved

  1. Custom staged-production URL
    acma.com” → production
    staging.acma.com” → staged production
    “acma.dev” → preview
    “*.preview.acma.dev” → all preview deployments

  2. Custom environments
    Custom environments solve our issue, but the Shared environment variables that we define on our organization level, these apply to all custom environments. Our project has two types—production (staging.acma.com) and preview (staging.acma.dev). Can we link a custom environment or URL to a specific combination of branch and deployment type (preview or production)? This is the option we envision.

acma.com” → promotion of staging.acma.com
“acma.dev” → latest main branch with preview environment
staging.acma.com” → latest release/* branch with production environment (like a staged production)
“staging.acma.dev” → latest release/* branch with preview environment

All other branches should create a deployment preview URL with *.preview.acma.dev with preview environment.

I think I am overthinking this how do other people who have 2 different domains solve this?

Hey @kasper-sprengers-kor,

I think I’m missing something about your deployment and promote to production workflow. I don’t quite follow how is a production deployment ends up on your .dev domain.

Could you walk me through the steps?

We have a custom Preview Deployment Suffix configured on preview.acma.dev. So now all preview deployments end up on something.preview.acma.dev.

If we promote a build to a staged production, that build gets the domain acma.com.preview.acma.dev. So now we have a build with production environment vars, on our acma.dev domain.

Edit: The cookie are on a domain level that includes all subdomains; so .acma.dev and .acma.com.