0

I am trying to set up in Azure an Application Gateway and two Web Apps using the same domain and same sub-domain, and the distinction is made by URL path. Something like this:

my.domain.com/app1 --->  app1.azurewebsites.net
my.domain.com/app2 --->  app2.azurewebsites.net

Now the tricky part - I do not want to use the option Override with new host name; instead, I want to add the binding for my.domain.com to both Web Apps - this is giving me an error due to a conflict.

The reasons why I want to keep the original host headers are described in this Microsoft documentation.

The only way I found to achieve my goal is to deploy both app1 and app2 on the same Web App instance in virtual directories. I would like to avoid this option because this will prevent me from scaling independently and brings some other complexities during the deployment, etc.

My question is - is my desired scenario really impossible, or did I overlook something?

many thanks for your suggestions!

Some facts I found during testing:

  • you cannot bind the same domain to two different Web Apps - Azure will reject this with a conflict error
  • Web Application will respond with an error if the host header is not matching the binding
Lukas K
  • 6,037
  • 4
  • 23
  • 31
  • AFAIK, it's not possible to add same domain to two app services at a time. – Tarun Krishna Mar 03 '23 at 03:47
  • I do not understand why that shouldn't be possible. The only reason I could think of is when all WebApps would use the same IP address, so without a proper unique hostname, the routing would not be possible. But in a VNet, it should be possible to assign a unique local IP address to each website and do proper routing, even if multiple WebSites have the same hostname.. – Lukas K Mar 05 '23 at 20:50

1 Answers1

0

exactly what i am facing, looks like it is kind of a limitation on the "fron end teir" of the webapps infrastructure / App service plan. i am still waiting for a confirmation but it seems like the routing (on our environment) from Azure application gateway back to the webapps is done according to the 'hostname' in the request and not according to the backend target. so i assume because both uses the same webapp infrastructure the http requests arrives to the same tiny proxy of the ASP that forward the request to the relevant webapp according to the HOST header which is what expected from a proxy to do.

i have tries to put the webpps on a different ASP and with different incoming IP but the result is the same.

dor
  • 1
  • I tried the same, no luck. I will try set up via Terraform; maybe the limitation is only on the UI level. I remember we managed it somehow having more apps with the same binding in the past, but not sure how we achieved that state. – Lukas K Mar 14 '23 at 15:06