ALB Path-Based vs Host-Based Routing

~10 min read

The two core ALB routing patterns, and how they combine to serve complex multi-service architectures from one load balancer.

Path-based routing matches on the URL path of an incoming request (e.g. everything under /api/ goes to one target group, everything under /static/ to another), and is the natural fit for a single-domain application split into multiple backend services by function. Host-based routing matches on the Host header instead (e.g. app.example.com routes to one target group, admin.example.com to a completely different one), letting a single ALB serve multiple distinct domains or subdomains, each potentially representing an entirely different application. The two can be combined in the same ALB's rule set — a request is evaluated against all configured rules in priority order, and the first matching rule's action determines routing, with a default catch-all rule handling anything that matches nothing more specific. This flexibility is why a single ALB, correctly configured, can serve an entire company's suite of applications and APIs rather than requiring a separate load balancer per service.

💬 Deep Dive with AI

Key points

  • •Path-based routing: match on URL path, ideal for splitting one domain into multiple backend services
  • •Host-based routing: match on Host header, ideal for serving multiple domains/subdomains from one ALB
  • •Rules are evaluated in priority order; the first match wins
  • •Both patterns can combine in one ALB, letting it front an entire multi-service, multi-domain architecture