Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subdomain Azure WebApp

This is more of a general question about. I have a website running as an Azure App Service. I configured a custom domain so that you are able to call it by my-site-name.com. As the request of customers kept growing and each customer has specific demands, I was wondering if it is possible to have a subdomain for each customer. For example, client1.my-site-name.com and client2.my-site-name.com. Is it possible to do all of this within a single App Service or do I need to set up an Azure App Service for each subdomain? The reason behind my question is, that it would be quite expensive to have an App Service for each individual customer.

like image 859
Tom el Safadi Avatar asked Apr 11 '19 20:04

Tom el Safadi


3 Answers

You should also consider just adding a wildcard custom domain entry. This is an older blog post, but it outlines Azure WebApp support for Wildcards:

https://azure.microsoft.com/en-us/blog/azure-websites-and-wildcard-domains/

This would mean that *.my-site-name.com traffic goes to your single Web App. Then it is up to the logic of your webapp to determine which client it is by inspecting the hostname of the request (client1.my-site.name.com) and taking the appropriate action to customize the response to that client.

Using a wildcard eliminates the need to add a specific custom subdomain mapping for each client.

like image 128
Bryan Lewis Avatar answered Oct 10 '22 20:10

Bryan Lewis


It should be possible. Within your app service, if you go to the settings for that service, there is a Custom domains option, select it.

Within there you can then map your subdomains to this service, and it allows you to do it multiple times. You just need to validate and set it up with the A record or CNAME and own the domain. Additionally, you should be able to add SSL Bindings for each.

Here are some documentation on it, I don't believe this documentation handles your exact use case but it does touch on the custom domain portion and should provide additional support.

https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-custom-domain

https://blogs.msdn.microsoft.com/waws/2014/10/01/mapping-a-custom-subdomain-to-an-azure-website/

Let me know if you need more

like image 26
Lucas Hendren Avatar answered Oct 10 '22 20:10

Lucas Hendren


This seems more like a domain management issue than an azure specific issue. You have already decided to have different sub domains to each customer. That, by definition, means each sub domain needs individual server space. That in turn would mean, an app service for each customer.

So, the answer is what you already have. Have an app service (essentially web server) for each customer via sub domain.

In your position, I would consider some alternatives.

  1. Rebuild your app to work with some form of login system, so clients login and get themselves a separate view.
  2. Alternatively, go with sub folders instead of custom domains. something like, domain.com/client1, domain.com/client2 and so on.
like image 32
Jay Avatar answered Oct 10 '22 20:10

Jay