When encountering a 404 Not Found error after attaching a custom domain to your Azure Static Web App, despite successful validation and correct DNS records, several factors could be at play:
- Propagation Delay: DNS changes can take time to propagate. If you've recently changed your DNS settings, it might take up to 48 hours for the changes to fully propagate across the internet.
- DNS Configuration: Ensure that your custom domain has the correct DNS records set up. If you are using an
A record, make sure a correspondingTXT recordis also added. It is generally recommended to use aCNAME recordinstead of anA recordfor custom domains, as using both can cause conflicts. - Slice Binding: Azure Static Web Apps only allow binding a unique domain to a single resource within a slice. If you are trying to bind a domain already associated with another resource, you will need to disassociate it first.
- Cache Issues: Although you mentioned clearing the CDN cache, also ensure that your browser cache is cleared as it might still hold onto the old IP address.
- Static Web App Configuration: Double-check your
staticwebapp.config.jsonfile for any routing issues that might only affect the custom domain. Ensure that the paths are correctly set up to serve the necessary files. - Internal Linking: You may want to confirm that your custom domain is correctly linked to your Static Web App instance. This can sometimes be verified through the Azure Portal.
If the problem persists, consider reaching out to Azure support with logs or additional configuration details for further assistance.
References: