Skip to content

Potential Bug: ALB listener URL path transform doesn't work with redirect

0

I have a basic listener with a simple rule on my load balancer. I added a simple path transform to the rule: ^/old-api/(.*) replace with /new-api/$1 and I set the action to be a 301 redirect to https://mysite.com:443/#{path}?#{query}.

The listener redirects the traffic to mysite.com:443 with the old-api in the path instead of new-api.

Is this a known bug? How can I track it and when will it be fixed?

asked 7 months ago226 views

1 Answer
0

This is not a bug but rather an expected limitation of AWS Application Load Balancer (ALB) functionality. According to AWS documentation, transforms for listener rules can only modify the path or query string of the URL when forwarding requests to targets, not when performing redirects.

When you configure a redirect action, the ALB takes the original request URL and redirects it according to your redirect configuration. The transform functionality is designed to modify requests before they are routed to targets, not to modify the URL that's used in a redirect action.

You cannot modify the protocol or port of the URL with transforms, and importantly, transforms don't work with redirect actions. They're specifically designed for forwarding actions where the request is being sent to a target group.

For your use case, you have two options:

  1. Use a forward action instead of a redirect, and apply your transform to modify the path before it reaches your backend service.

  2. If you must use a redirect, you would need to create separate listener rules with specific path patterns that match your old paths and explicitly redirect to the new paths without using transforms.

This is a limitation in the current design of ALB listener rules rather than a bug that would be fixed in a future update.
Sources
Transforms for listener rules - Elastic Load Balancing
Elastic Load Balancing controls - AWS Control Tower

answered 7 months ago

EXPERT

reviewed 7 months ago

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.