Netlify DNS - Deploy Preview and Branch Deploys

Hello!

We have a couple of front end projects we’d like to migrate to Netlify.
The problem is that our API has a CORS policy that only allows requests from specific domains, therefore we can’t use features such as deploy previews because the requests would come from deploy-preview-****.netlify.com.

Adding the Netlify domain to our CORS policy is not an option, since it is not secure.

Our solution for this problem would be to purchase another domain through Netlify’s DNS (e.g. ourdomain.com) and add it to our CORS policy. Its sole purpose would be branch deploys and deploy previews for all sites in our account.

However, we’d like to keep different “Primary domain” and “Domain alias” as the domains for production branches of each site (currently set to custom domains that are managed in another domain registrar).

Would all deploy previews and branch deploys, for all sites in our account, be available though this purchased domain (i.e. deploy-preview-****.ourdomain.com)?

Hi @Cobli_Tech,

Deploy Previews will always be on the *.netlify.com domain, but branch deploys can have subdomains on your own custom domain. Can you dynamically set the value of Access-Control-Allow-Origin so that anything that any domain that ends in your-netlify-subdomain.netlify.com is allowed? That would be the simplest path.