Path-based Request Routing for AWS Application Load Balancers Not working

0

Hello, I am exploring Path-based request routing within ALB listener rule. I have created following in order to setup rule.

  1. Created ALB
  2. Created two target group
  3. Created two Auto Scaling Group (ASG). Each one targets two each target group (tg1 and tg2). Both ASG has same launch template to launch instance in target group
  4. Modified ALB's HTTP listener rule to forward one path request (say /test) to tg1. And rest of the path request can go to default rule with tg2.

With above configuration, /test does not forward request to tg1, but to tg2. Not sure why. Ideally it should be right? Is it because ASG is having same launch template?

When I configure /test url to return fixed response, it works. Can you help here?

Regards.

Gaurav
asked 10 months ago598 views
2 Answers
1
Accepted Answer

Hi, last week I configured an application load balancer.

Here's a summary of your configuration: ALB ---> 2 ASG (same launch template) rule 1: path request (say /test) to tg1 default tg2


First of all, I encourage you to check the following documentation:

Please ensure that you have correctly added the path (/test/*) in the rule. Additionally, make sure that your application has the correct API, which should be located at the path /test/ and not the root path (/). Also, create the correct listeners for your application. In our case, we were initially configuring HTTPS as the target, but the application was not prepared for it. When we changed it to HTTP, everything started working again."

I hope that can help to you!

Judith
answered 10 months ago
profile picture
EXPERT
reviewed a month ago
  • Thanks for the response. Issue is resolved after using /test/* path.

    One Doubt: Suppose tg1 has only one instance running, and went unhealthy/ unavailable.. Can my /test/* request go to instances behind tg2. For my need, I just want to maintain exactly one instance in tg1.

0

It sounds like you have both ASGs registering their instances to both TGs, is that correct? If so, how are you checking which TG the request is getting routed to? Other than the ALB metrics, both requests could be served by any instance. Generally with path based routing like this you would either

  1. Have a single ASG registering instances to both TGs, and have the webserver handle the correct routing of requests (for example, you might have each TG forwarding requests on a different port). However, in this situation you could also just eliminate the path based routing and second TG, and have the webserver handle the traffic differently based on path
  2. Have 2 ASGs, each registering instances to one of the TGs. This is usually what you would do if there's differences in the instances themselves (different launch template with different applications/configurations)
AWS
answered 10 months ago
  • Thanks for quick response. No, I have ASG1 registering instances to TG1 and ASG2 to TG2. It is one-one mapping.

    Scenario is - In both TG, same application is running, but I want /test path should go to TG1 only and rest of the url path should go to TG2.

    Actually application is very old and certain feature works within one instance.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions