Custom domains for preview environments in Azure Static Web Apps?
Asked Answered
J

1

5

On Azure Static Web Apps, you get 10 staging environments with a pro plan, and you can set these up to have stable URLs per-branch.

I've got a few branches like this (eg. stage, dev, etc.) that I'd like to be subdomains on our default domain. Meaning, builds on branch stage would go to stage.foo.com and so on. I've added a few of them as custom domains, but these all go to the main/production branch. I can't figure out how to point them to the specific staging branch.

I thought one option might be to set the CNAME of the subdomain to the stable branch domain, like:

CNAME  stage  foo-stage.1.centralus.azurestaticapps.net

But I can't find mention of this anywhere and I worry that it wouldn't validate the domain this way. Is there a way to do this?

Johanajohanan answered 19/7, 2022 at 21:35 Comment(0)
P
8

I have the same issue. The documentation does not mention this as an option. I tried adding a CNAME record to a named stable environment. However, this does not work due to HSTS, HTTP Strict Transport Security, being enabled by Azure on the named environment.

Edit: I have created a support ticket with Microsoft. I will update when I get a response

Edit2: Currently it's not possible to use a custom domain for named environments. It is possible to add custom domains to Azure App Services..

I have created a suggestion to get this feature added https://feedback.azure.com/d365community/idea/e255188c-7918-ed11-a81b-6045bd853198

Penrod answered 28/7, 2022 at 7:55 Comment(2)
Thanks for doing that! Did you ever get a response?Johanajohanan
@Johanajohanan I just got a final response today and currently it's not possible. I have created a suggestion to add it in: feedback.azure.com/d365community/idea/…Penrod

© 2022 - 2024 — McMap. All rights reserved.