Intermittent 404 with Static Web App Using Custom Domain with Alias Record Set in Azure DNS Zone

PINT Services 0 Reputation points
2025-08-12T22:29:03.3733333+00:00

I am experiencing intermittent 404 errors when trying to access a Static Web App via a custom domain. Accessing the Static Web App using the *.azurestaticapps.net domain or a subdomain of our domain works fine, but accessing it via the root domain only works about 85% of the time.

We are not using an Application Gateway, Traffic Manager, or Azure Front Door.

We are using Azure DNS to manage the domain.

  • When the apex of the domain is an A record with an IP address we don't see any issues, but this disables global distribution of our static assets so this is not ideal.
  • When the apex of the domain is an A record with an Alias record set pointing to our Static Web App, about 15% of requests return a 404 error. These are all requests to the same URL.
  • If I mark a subdomain as the default custom domain I still see 15% of requests to the apex of the domain returning a 404 instead of a redirect to the default custom domain.
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

1 answer

Sort by: Most helpful
  1. Vishvani Jilukara 5 Reputation points Microsoft External Staff Moderator
    2025-08-13T12:23:14.7033333+00:00

    Hii PINT Services,
    The intermittent 404 errors when trying to use a custom domain with an Azure Static Web App, particularly when using the root (apex) domain with an Alias record in Azure DNS some possible reasons for this issue can be

    1. Static Web App Routing and Redirection:
    • Ensure that the Static Web App is properly configured to handle redirects from the apex domain to the subdomain. You can configure these redirects in the routes. Json file in the static web app configuration.
    • If you're not already, test using a browser and inspect the network traffic to check for any redirect issues or misconfigurations.

    2__.__ Alias Record vs. A Record:

    • When using an Alias record, ensure that your DNS TTL (Time-to-Live) isn't causing problems. A lower TTL can help, especially during periods of change. Additionally, check if your DNS settings are correctly aligned with the Azure Static Web App requirements.

    Since the issue doesn't occur with the A record (but disables global distribution), the problem likely lies with the Alias record configuration. It's important to make sure that both your DNS setup and the Static Web App configuration (especially the custom domain settings) are aligned.

    1. App Service Scaling or Load Balancing:
    • Look at the Azure Static Web App's health and scaling settings. If it's in a region with heavy load or scaling issues, that might cause intermittent availability.
    1. Azure Static Web App Configuration (Deployment Settings):
    • Review your Azure Static Web App's deployment logs for any errors during build or routing. Ensure that your app's routing rules are correctly defined.

    You can mark it 'Accept Answer' and 'Upvote' if this helped you

    Regards,

    Vishvani


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.