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
已提問 10 個月前檢視次數 641 次
2 個答案
1
已接受的答案

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
已回答 10 個月前
profile picture
專家
已審閱 1 個月前
  • 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
已回答 10 個月前
  • 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.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南