Azure Wildcard Subdomains

Azure App Service does not natively support wildcard subdomains (*.myapp.azurewebsites.net) under the default azurewebsites.net domain. However, you can achieve wildcard subdomains using a custom domain.

To set up wildcard subdomains in Azure App Service:

  1. Custom Domain Requirement:
  2. Add a Wildcard DNS Record:
    • In your DNS provider’s management console, create a CNAME record or an A record with a wildcard. For instance:
    • *.myapp.com → point this to your Azure App Service’s default domain (myapp.azurewebsites.net).
    • Ensure that the DNS is properly configured to allow traffic from any subdomain to be routed to your app service.
  3. Bind the Wildcard Domain to Azure App Service:
    • In the Azure portal, go to your Azure App Service.
    • Navigate to Custom domains.
    • Add your custom domain (*.myapp.com) and verify it. You may need to validate ownership of the domain via DNS records.
  4. TLS/SSL Configuration
    • To secure your wildcard subdomains, you’ll need a wildcard SSL certificate. Azure App Service supports SSL certificates, including wildcards.
    • Upload the wildcard certificate in the TLS/SSL settings section of your Azure App Service.

Limitations of azurewebsites.net:

Azure App Service provides subdomains under azurewebsites.net, but wildcard subdomains (e.g., *.myapp.azurewebsites.net) are not supported for this domain. You would need to switch to a custom domain if you require wildcard subdomains for your app.

Workaround for Dynamic Subdomains:

If you can’t use a custom domain, a possible workaround is to programmatically handle subdomains in your application. You could inspect incoming requests for subdomains and route them accordingly within your application code, but each subdomain would still have to be manually set up or handled dynamically.

Leave a Reply