Yosh
Yosh

Reputation: 23

How two set up three app services for the same domain on Azure

Presently I have two app services on Azure

  1. An Angular 7 application - mydomainUI.azurewebsites.net
  2. A NET Core web API - mydomainAPI.azurewebsites.net

I also have two DNS records on godaddy:

An A record to the Azure IP address and a text record @ to mydomainUI.azurewebsites.net

Angular makes the API calls to the azure domain. Everything works fine but the home page load takes too long with all the Angular overhead. I would like to add a third app service: a fast loading MVC application that handles the home page ONLY. It would be something like mydomainPUBLIC.azurewebsites.net. All other requests should be handled by the Angular routing of the UI app service. The browser should only show mydomain.com for everything and not the azure domains.

Can this be done without sub-domains? What DNS record(s) would I have to add on godaddy? Any other considerations?

Thank you in advance

Upvotes: 1

Views: 2686

Answers (1)

Nancy Xiong
Nancy Xiong

Reputation: 28224

I don't think you can route to different web app service with the same domain unless you use subdomains. However, if you consider using path-based URL to access your different web apps, here are two options for you.

  1. You can place multiple web apps in the same web app service with different Azure virtual directories. See here1 and here2. Then set the custom domains in your current web app service.
  2. You could use Azure application gateway route to multiple web app services based on Path URL. URL Path-Based Routing allows you to route traffic to back-end server pools based on URL Paths of the request.

    You could follow this to configure App Service with Application Gateway. You need to

    • Create three backend pools and place each app service in the separate backend pool.
    • Create three HTTP Settings and Custom Probe with “Pick Hostname” switches enabled(Check Use App Service check box)
    • Create a basic backend listener and a path-based routing rule. Refer to this tutorial.

If you face any question, please let me know.

Upvotes: 3

Related Questions