hookenz
hookenz

Reputation: 38879

AWS Application Load balancer path routing issue

I have a fairly comprehensive application load balancer set up that routes based on host name.

However, I'm trying to introduce the following but can't get the path routing to work.

i.e. I have them in this order.

  1. licence.example.com/api -> Target Group B
  2. licence.example.com -> Target Group A

What I'm seeing is everything is routed to Target Group A.

I have Rule 1 set to host licence.example.com, path: /api/* And Rule 2 set to host licence.example.com

I've tried changing the order by swapping them around. And I've tried adding a path to rule 2 as /* but it doesn't work.

Is the AWS load balancer not capable of this most basic configuration? Am I going to have to throw it out and use nginx?

Upvotes: 0

Views: 2775

Answers (1)

hookenz
hookenz

Reputation: 38879

Two problems.

  1. The order displayed in the UI is important. Rules higher up are list are a higher priority. So first I had to ensure the match with the path occurred first.

  2. The requests to /api/* come through to the application with the path /api/ included. No rewrite like nginx which would strip it off. So the fix was to make a small change to the app listening at Target Group B to expect the /api/ path. I made this a config value and then it all worked.

Upvotes: 2

Related Questions