应用程序网关将URL路由到自定义端口 [英] Application Gateway routing URL's to custom ports

查看:120
本文介绍了应用程序网关将URL路由到自定义端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个可通过以下设置运行的Application Gateway

We have an Application Gateway operational with the following setup

Backend 1 : Server A, Server B
Backend 2 : Server C

Listener1 - site.com - Port 8888 HTTPS - Backend 1
Listener2 - site.com - Port 3000 HTTPS - Backend 2 
Listener3 - site.com - Port 10001 HTTPS - Backend 1

在指定site.com:port时,这可以正确路由,但这对于最终用户要记住包括端口并不理想.

This is routing correctly when site.com:port is specified however this isn't ideal for the end user to remember to include the port.

我们要做的是

sub.site.com to map to site.com:8888
sub2.site.com to map to site.com:3000
sub3.site.com to map to site.com:10001

OR

site.com/sub to map to site.com:8888
etc

这将允许用户通过友好的URL(而不是端口号)连接到服务.

This will allow the users to connect to the service via a friendly URL rather than the port number.

将路径设置为/sub并将HTTP设置作为自定义端口的基于路径的规则是否足够?

Would a path-based rule with the path as /sub and the HTTP setting as the custom port be sufficient?

任何建议,我们将不胜感激.

Any advice greatly appreciated.

推荐答案

您可以通过

You could do this via path-based routing rules or multi-site listener.

对于第一种情况,您需要sub.site.com to map to site.com:8888.您可以创建一个多站点侦听器,然后在此多站点侦听器中使用前端端口 80和主机名 sub.site.com. HTTP设置应指定端口8888.

For the first scenario, you want sub.site.com to map to site.com:8888. You could create a multi-site listener, then use frontend port 80 and hostname sub.site.com in this multi-site listener. HTTP setting should specify the port 8888.

第二次,您需要site.com/sub to map to site.com:8888.您可以添加基于路径的规则,将路径/sub/*以及后端pool1和HTTP setting1设置为端口8888.此外,侦听器应具有前端端口80.

For the second, you want site.com/sub to map to site.com:8888. You could add a path-based rule, set paths /sub/* and backend pool1 and HTTP setting1 with port 8888. Also, the listener should have frontend port 80.

确保侦听器正在侦听端口80,并且HTTP设置具有用于后端网站的自定义端口.如果您要进一步发布网站,建议使用多站点网站.如果您希望将此请求用作无状态请求并托管网站,则可以使用基于路径的规则.

Make sure the listener is listening port 80 and HTTP setting has your custom port for your backend websites. If you will publish your website in the further, It's recommended to use multi-site websites. If you want to use this as a statusless request and hosting your websites, you could use path-based rules.

这篇关于应用程序网关将URL路由到自定义端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆