SSL Cert error on apex domain for Static Web App (sudomain is working fine)

Benjamin Fellner 105 Reputation points
2024-01-25T17:38:11.48+00:00

Hi there, I have configured the custom domain for my static web app like described here: https://learn.microsoft.com/en-us/azure/static-web-apps/custom-domain-azure-dns For the subdomain www.example.com it's working fine (SSL also there), but for my apex domain example.com it's not working, always get a certificate error. In the static web app, my apex domain is validated (green checkmark), but under action I still have "Add a CNAME, ALIAS or A record", but I already added the A record like described. What could be the issue here?

Thanks

Azure DNS
Azure DNS
An Azure service that enables hosting Domain Name System (DNS) domains in Azure.
603 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
779 questions
{count} votes

Accepted answer
  1. TP 78,826 Reputation points
    2024-01-25T22:51:22.95+00:00

    Hi Benjamin,

    You don't want to use A record with static web app. Use either CNAME or ALIAS. With this in mind, I suggest deleting the A record, adding a CNAME with TTL as low as possible (e.g. 30 seconds, 1 minute), waiting several minutes, and then testing.Depending on the previous TTL, you may need to wait for several hours for the old DNS record to expire. To combat this you could test using a different DNS server for name resolution on your local workstation, or maybe use a different network connection that you never tested from before.

    On your local PC, you want to be able to run below command and get canonical name response that points to the static web site FQDN as shown in the portal:

    nslookup <yourapexdomain.com>

    If it still shows the previous IP address then you know DNS record hasn't propagated to your local PC's DNS name resolution server.

    In some cases I've had to delete the domain out of the portal, delete the relevant DNS records for that domain (TXT, A, CNAME, ALIAS for the apex), wait 15 minutes, then add the domain back, generate code, create TXT record, wait for it to verify, create CNAME record, then finally wait for it to be done and verify that certificate is correct on site.

    In general when you are first getting things set up configure the TTL for your DNS records as low as possible. After everything is working great you can go back in and increase the TTL.

    Please click Accept Answer and upvote if the above was helpful. If something is unclear please add comment below.

    Thanks.

    -TP


0 additional answers

Sort by: Most helpful