0

I currently have one App Service with one domain and one wildcard certificate. I have WordPress and using multiple subdomains has worked so far for schools and district. ex District1.contoso.com School1.contoso.com, School2.contoso.com.

Issue now is that the next district has new requirements but we want to use the same domain. This second district will be on a different App Service. Ex. District2.contoso.com, SchoolA.contoso.com, SchoolB.contoso.com, SchoolC.contoso.com.

We have both App Services setup, we have an *Application Gateway with rules and listners and such. We also have a Virtual Machine with IIS to do redirect from an old domain. (Ex. *.oldcontoso.com)

I can't find instructions on how to have the same domain but sub-domains pointing to different App Services. I only found pointing two different domains to two apps but this is not the case.

How do I redirect the sub-domains to different app services. (ps, I expect a repeat with other districts)

clnlgr
  • 21
  • 3

1 Answers1

0
  • In order to group your websites, you have to configure the custom domain name for your Azure websites.
  • You could use the virtual directory for deploying multiple application to a single Azure Website ( Single Domain), your apps would look like: contoso.com/District2/, contoso.com/SchoolA/ , contoso.com/SchoolB/.contoso.com/SchoolC/

Publish the root project

  • Once your solution is ready to deploy, the next step is to publish the root project (Web) to Azure websites.

Set up the Virtual Directory or Application

  • Before attempting to deploy the second project, go into the Azure Management Portal and configure the details for the IIS virtual directory or application in the website’s configuration. You need to specify the name of the directory, the file system location, and whether you want to mark it as an IIS application. Be sure to save your settings to apply the changes to Azure.

  • Go to portal > demo-site App Service > Configuration > Path Mappings > Virtual applications and directories. And add the following,

  • enter image description here enter image description here

Publish the child project(s)

  • Once your application is set up, deploy your child projects. Select the same Azure subscription and website that you used for your root project. Include the virtual directory path in the Site Name and Destination URL sections on the Connection tab.

  • If you only need to publish to a first level folder, i.e to demo-site\folder, then all you have to do is, change the Type to Application in the Path mappings for /folder, and skip the sub-folder entry since you don’t need it. And correct the Site Name and Destination URL in the publish profile accordingly.

Please refer Map an existing custom DNS name to Azure App Service for more details

Updated Answer

  • Application Gateway supports multiple applications each listening on different ports
  • You can configure path-based routing rules on the application gateway.
  • By this the Application gateway will route request to different backend pools, based on the requested path.
  • You can also have Rewrite HTTP headers with Application Gateway

Please refer application gateway with path-based routing rules , multiple site hosting , URL Path Based Routing and SO thread for more information.

  • Thank you for the detailed answer. Folders aren't an option, subdomain must be used. WordPress has handled over 60 schools already using the School61.contoso.com example. The other schools and district have agreed and want the same format. – clnlgr Jan 20 '22 at 14:58
  • Application Gateway can have set of backend pools, and with the path based routing you should be able to direct traffic to different backend pools as required. – HarshithaVeeramalla-MT Jan 21 '22 at 07:21
  • @clnlgr - Please check the updated answer once. – HarshithaVeeramalla-MT Jan 21 '22 at 07:30
  • I can't check up or down your answer. DOWN. as I answered, your instructions talk about different domains. My issue is with the use of the same domain on two app services. App Service 1 : SchoolA.contoso.com, SchoolB.contoso.com, SchoolC.contoso.com App Service 2 : SchoolY.contoso.com, SchoolZ.contoso.com – clnlgr Jan 25 '22 at 18:31
  • You have to register the new CNAME from your web application in the DNS server before adding it to Azure App Service. And then add the custom domain to your new web application. – HarshithaVeeramalla-MT Jan 26 '22 at 05:28
  • When forwarding to multiple servers in the same domain, you can use Azure Front Door or Azure Application Gateway to set routing rules on a path basis.You can use Azure Front Door to configure how to handle multiple backend applications under one domain.Refer [this](https://docs.microsoft.com/en-us/azure/application-gateway/url-route-overview) – HarshithaVeeramalla-MT Jan 26 '22 at 05:38
  • This MS Q&A explains about [Running same custom domain in different Azure App Services in same region](https://docs.microsoft.com/en-us/answers/questions/202552/running-same-custom-domain-in-different-azure-app.html) and [SO thread](https://stackoverflow.com/questions/46033446/multiple-app-services-to-use-the-same-domain-name) – HarshithaVeeramalla-MT Jan 26 '22 at 05:38
  • @clnlgr - Any update regarding the issue ? – HarshithaVeeramalla-MT Jan 31 '22 at 12:31
  • You're refering to a PATH, I'm refering to at SUBDOMAIN. – clnlgr Jan 31 '22 at 20:54
  • Would you have any update regarding the issue ? – @HarshithaVeeramalla-MT – clnlgr Feb 02 '22 at 13:42