Course contentsShow
← Cloud and Infrastructure
Lesson 249 of 2,9895. Load Balancing and Traffic ManagementFree lesson

Path-Based Routing

Configure URL path patterns to route requests to specific microservices or application tiers dynamically.

Path-Based Routing

What you'll learn: How to use URL paths to intelligently direct traffic to different backend services using Application Load Balancers.

The Core Idea

Path-based routing lets you examine the URL path of an incoming request and route it to different target groups based on patterns you define. Instead of sending all traffic to one destination, you can split it intelligently based on what the user is requesting.

Think of it like a mail sorting facility: letters addressed to "123 Main St, Apartment A" go to one mailbox, while "123 Main St, Apartment B" go to another—same building (domain), different destinations based on the details (path).

How It Works

With an Application Load Balancer, you create rules that match URL path patterns:

  • Requests to /api/* → Route to your API server target group
  • Requests to /images/* → Route to your image service target group
  • Requests to /admin/* → Route to your admin panel target group
  • Everything else (/*) → Route to your default web server target group

The ALB evaluates rules in priority order (just like you learned with ALB Rules). When a request arrives for https://example.com/api/users, the load balancer checks the path /api/users, matches it against your rules, and forwards it to the appropriate target group.

Why This Matters

Path-based routing enables microservices architectures where different application components run on different servers, but all appear under one domain to users. You can scale, update, and manage each service independently while presenting a unified interface.

Key Takeaway: Path-based routing uses URL paths as routing criteria, letting you direct different parts of your application (like /api/* or /images/*) to specialized backend services—all through a single load balancer endpoint.