How to divert the traffic to targer servers withou

2020-05-09 19:07发布

问题:

I have 4 web servers, These web servers hosts nearly 8 different websites. I am planning to use path based routing like http://myexample.com/website1/..

For example when i deployed by application on port 8580 and create the path based rule in ALB.. and hit the url it is not working. Instead i had to use http://myexample.com:8580/website1.

Please help to resolve this, how can i remove the port number from URL.

Since all these are internal application under single domain. I do not have an option of using different domain names or different load balances.

回答1:

The reason is your load balancer listening on the same port which is used in the webserver.

You need to define a listener for LB to listen on a port and forward traffic to target on the desired group.

specify port 8580 in the target group and specify 80 in the Loadbalancer listener.

Update:

If all application running on the same instance you need host-based routing.

In the above screenshot, suppose behind each target group there is one instance, but five different target group so api.example.com will route to its own target group.