Vishal Bhosle
Vishal Bhosle

Reputation: 33

How to have path based routing for AWS Application Load Balancer

I have deployed 2 services in ECS Web and API, Both of the services have their ALB, How can I configure my domain as follows:

I tried creating a single ALB for both web and api target group and added a path based routing in rules but /api request is received by nodejs with full path, Eg. if a call example.com/api/products node is getting /api/products instead of /products

What could be a proper way of implementing this?

Thanks!

Upvotes: 0

Views: 498

Answers (1)

Marcin
Marcin

Reputation: 238081

call example.com/api/products node is getting /api/products instead of /products

That's correct and that's how it should work. In other words, ALB can't change path from /api/products to /products, because ALB only forwards requests, it does not re-write them.

You can have a look at CloudFront, which could be helpful in that case.

Upvotes: 1

Related Questions