Azure: Route subdomain traffic to different backend port

纵饮孤独 提交于 2021-01-29 07:53:43

问题


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)?


回答1:


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. Type the subdomains as the host name

Health probes

Add a health probe and checkbox pick host name from backend http settings.

HTTP settings

Add three HTTP settings and specify the custom port on each of HTTP settings.

Rules

Add three basic rules with corresponding Listener and HTTP settings and backend pool.



来源:https://stackoverflow.com/questions/57552417/azure-route-subdomain-traffic-to-different-backend-port

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!