SturmUndDrang
SturmUndDrang

Reputation: 1956

Azure: Route subdomain traffic to different backend port

I have multiple sites hosted on the same machine in Azure on different ports:

foobar.com:8000
foobar.com:8001
foobar.com:8002 

etc

I would like to address these by subdomain using a reverse proxy;

aaaa.mysite.com ----> foobar.com:8000
bbbb.mysite.com ----> foobar.com:8001
cccc.mysite.com ----> foobar.com:8002

Is it possible to do this in Application Gateway? It only seems to cater for different paths (not subdomains) and doesn't allow ports to be specified for backends.

Is there another Azure feature that allows for this (e.g. Front Door)?

Upvotes: 2

Views: 2656

Answers (1)

Nancy Xiong
Nancy Xiong

Reputation: 28224

As your requirement to address them by subdomains in APP GW, you could use multi-site hosting.

There are three common mechanisms for enabling multiple site hosting on the same infrastructure.

Host multiple web applications each on a unique IP address. Use host name to host multiple web applications on the same IP address. Use different ports to host multiple web applications on the same IP address.

For example, you want aaaa.mysite.com ----> foobar.com:8000. The main configuration will be like this: create a multi-site listener, use frontend port 80 and hostname aaaa.mysite.com in this multi-site listener. HTTP setting should specify the port 8000. Make sure the listener is listening on port 80 and HTTP setting configure your custom port for your backend websites.

In this case, you will create 3 Listeners with on same port 80,and specify the hostnames and create 3 HTTP settings, and create rules with corresponding Listener and HTTP settings and backend pool.

The Azure front door also has URL-based routing and Multiple-site hosting ability. Refer to this document.

Update

Backend pools

Create one backend pool and set your Azure VM as the backend in the backend pool.

Listeners

Click multi-site to create a multi-site listener then save it. You need three listeners for your host name. enter image description here Type the subdomains as the host name enter image description here

Health probes

Add a health probe and checkbox pick host name from backend http settings. enter image description here

HTTP settings

Add three HTTP settings and specify the custom port on each of HTTP settings. enter image description here

Rules

Add three basic rules with corresponding Listener and HTTP settings and backend pool. enter image description here

Upvotes: 2

Related Questions