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
- 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.
- 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.
- 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