Custom domain on Azure Static Web App returns 404 despite successful validation

Jesper Møller Hansen 0 Reputation points
2025-12-11T07:47:15.6466667+00:00

Hi Microsoft Support,

I’m hosting a frontend on Azure Static Web Apps. The application works correctly when accessed through the default Azure domain. However, after attaching my custom domain, I consistently receive a 404 Not Found when accessing the site. The custom domain shows as Validated in the Azure Portal, HTTPS is enabled, and no warnings are displayed.

The static site continues to load correctly via the default SWA domain.

I have already taken the following steps:

  • Cleared the CDN cache

Redeployed the application

Verified that the build output is correct (index.html is located in the root of the dist folder)

Confirmed that routing in staticwebapp.config.json is configured properly

Verified that the issue only occurs when using the custom domain

Questions:

Could there be a propagation delay or configuration issue on the Azure side that would cause a validated custom domain to return 404 despite correct DNS records?

Are there any known issues where Azure Static Web Apps fail to map custom domains correctly to the production environment?

Can you confirm whether my custom domain is correctly linked internally to the SWA instance?

Is there anything server-side in my Static Web App configuration that could cause a 404 only when using the custom domain?

Please let me know if you need logs, screenshots, or configuration files — I can provide anything required.

Thank you in advance.

Best regards,

Jesper Hansen

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2025-12-11T07:47:33.8+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    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:

    1. 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.
    2. DNS Configuration: Ensure that your custom domain has the correct DNS records set up. If you are using an A record, make sure a corresponding TXT record is also added. It is generally recommended to use a CNAME record instead of an A record for custom domains, as using both can cause conflicts.
    3. 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.
    4. 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.
    5. Static Web App Configuration: Double-check your staticwebapp.config.json file for any routing issues that might only affect the custom domain. Ensure that the paths are correctly set up to serve the necessary files.
    6. 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:

    0 comments No comments

  2. Golla Venkata Pavani 260 Reputation points Microsoft External Staff Moderator
    2025-12-11T09:05:21.7366667+00:00

    Hii Jesper

    It sounds like you're having trouble with your custom domain on Azure Static Web Apps returning a 404 error, even though everything seems validated correctly on the Azure Portal. Here are some things to consider and steps you can take:

    1. DNS Propagation: Sometimes DNS changes can take some time to propagate fully across the internet. You can check your DNS configuration using a tool like DNS Checker to see if the DNS records have propagated globally.
    2. Configuration Verification: Make sure your DNS records are set up correctly:
      • Ensure you have the appropriate CNAME record for www.yourdomain.com pointing to your Azure Static Web App's default domain (like yourapp.azurestaticapps.net).
      • If you're using an apex domain (like yourdomain.com), ensure you have an A record pointing to the IP address mentioned in the Azure portal for your static web app.
    3. Routing and Application Set-Up: You mentioned checking staticwebapp.config.json. Double-check that all routing rules are correctly defined and that your application structure is intact. The index.html file should be in the root of your output directory.
    4. Stale DNS Records: Clearing the DNS cache on your machine can sometimes resolve routing issues. You can do this on Windows using the command ipconfig /flushdns.
    5. Check for Conflicts: Ensure that your custom domain isn't bound to another Azure Static Web App. Using the same custom domain for multiple apps can lead to intermittent 404 errors.
    6. Private DNS Issues: If you've set up a private DNS zone, remember that it's not supported for custom domains in Static Web Apps. Ensure your DNS is publicly resolvable.
    7. Review Permissions: Confirm that there are no security rules set that could block access when using the custom domain.

    Hopefully, these steps help lead you to a solution! Let me know if there's anything else you need. Here are some relevant resources for your reference:

    Reference:
    https://dori-uw-1.kuma-moon.com/en-us/azure/static-web-apps/custom-domain
    https://dori-uw-1.kuma-moon.com/en-us/azure/app-service/app-service-web-tutorial-custom-domain?tabs=root%2Cazurecli#create-the-dns-records
    https://dori-uw-1.kuma-moon.com/en-us/azure/app-service/troubleshoot-domain-ssl-certificates?source=recommendations#custom-domain-problems

    0 comments No comments

Your answer

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