Reputation: 475
I am new to microservice. My team is developing new application and it will have about 20 microservice spreading across 3 aws ecs ec2 instance. Each of this docker containers will be listening on any of the high port (host port) and forward the request to port 80 of docker
My requirement is to have domain.com/core >> should route to "core" docker container domain/customer >> should route to "customer" docker container
I am testing with the application load balancing such that domain.com/core rule will be forwarded to the corresponding target group and that target group will be registered by the corresponding high port (host port) of docker container.
But it is not working as I expected
I guess when domain.com/core is called it is routing to the corresponding docker container but instead of looking into the doc root of "core" microservice it is actually looking for the directory "core" under the doc root of that micorservice. Any solution for this?
Upvotes: 0
Views: 455
Reputation: 3667
Yes. It's common to put a load balancer in between ALB and your docker services. With nginx the configuration would be something like this: https://serverfault.com/questions/562756/how-to-remove-the-path-with-an-nginx-proxy-pass
If you want to avoid putting another load balancing layer in front of your application you could try solving it at the application layer, just have all of your services broadcast with the /core or /customer prefix already.
Sadly ALB does not support rewriting the url.
This is also part of the reason why people make prolific use of subdomains instead of url paths ;) customer.domain.com core.domain.com
Upvotes: 1