An ALB must route `/api` to one service and `/` to another, and also redirect HTTP to HTTPS. How?
IntermediateScenarioEC2, Auto Scaling and Load Balancing
Answer
Situation read → Listener rules handle path routing and redirects natively.
What I'd do →
- Listener 80: default action redirect to HTTPS 443 with status 301
- Listener 443 with ACM certificate and a rule
path-pattern /api/*forwarding to the api target group - Default action forward to the web target group
- Check rule priority order
aws elbv2 describe-rules --listener-arn ...
Why → Rules evaluate in priority order, so specific paths must come before the catch-all.
Interview tip → Mention host-header rules for multi-tenant routing.