Custom domain added but not reachable

Davy Raitt 30 Reputation points
2023-10-03T14:19:10.34+00:00

Hey all!

I have been following these steps:

https://www.mikaelsand.se/2022/09/custom-domain-for-a-static-webapp-using-bicep/ 

To map a custom domain name to my Azure SWA. First I added a CNAME record to my DNS provider:

CNAME: ticket-notes-module.test.loyally.nl -> zealous-flower-032981e03.3.azurestaticapps.net

This is my bicep file:

// Load JSON Content
var environmentVariables = loadJsonContent('./env_variables.json')
var appServiceAppName = environmentVariables.webAppName
var webAppName  = '${appServiceAppName}-test'
param location string = 'West Europe'
                        
resource staticWebApp 'Microsoft.Web/staticSites@2022-09-01' = {
  name: webAppName
  location: location
  properties: {}
  sku: {
    name: 'Free'
    tier: 'Free'
  }
}

resource staticwebApplicationDomain 'Microsoft.Web/staticSites/customDomains@2022-03-01' = {
  name: 'ticket-notes-module.test.loyally.nl'
  parent: staticWebApp
}

This deploys succesfully and I can see the custom domain in my app:

example_tnm

NSLookup also seems to find the match:

 nslookup ticket-notes-module.test.loyally.nl
Server:  dns.mnd.iss.as9143.net
Address:  2001:b88:1002::10

Non-authoritative answer:
Name:    waws-prod-am2-4f0021d1.sip.p.azurewebsites.windows.net
Address:  20.101.2.157
Aliases:  ticket-notes-module.test.loyally.nl
          zealous-flower-032981e03.3.azurestaticapps.net
          azurestaticapps3.trafficmanager.net
          msha-slice-3-am2-0.msha-slice-3-am2-0-ase.p.azurewebsites.net

But when I browse to http://www.ticket-notes-module.test.loyally.nl/ it doesn't work. Does anybody have any clue what i'm doing wrong?

Thanks in advance!

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,178 questions
{count} votes

Accepted answer
  1. Thomas Meads 1,586 Reputation points
    2023-10-03T15:15:25.0766667+00:00

    Hi,

    The cname record you have setup is for the apex of the domain. This means that navigating to https://ticket-notes-module.test.loyally.nl/ will work. However www. is a subdomain and needs a cname to be setup as well. To my understanding the recommended way of doing this is setting up a cname record that points to ticket-notes-module.test.loyally.nl as it simplifies updates in the future.

    Hope this helps.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.