Content-based load balancing
GCP offers different kinds of load-balancing options for HTTP/HTTPS requests, SSL (TLS) connections, and non-HTTP TCP traffic. In addition, there are two other types of load balancing for advanced use cases; an internal load balancer for internal TCP/UDP-based traffic and a network load balancer for all other TCP/UDP and SSL traffic on ports that are not supported by the standard HTTP/HTTPS, SSL proxy, and TCP proxy load balancers.
In this recipe, we'll create a simple HTTP load balancer that will route traffic; based on the content requested.
Our HTTP load balancer will be configured such that:
- All URL paths starting with /image will be routed to the instance group image to serve the images for the website
- All URL paths starting with /static will be routed to our Google Storage bucket to serve static content
- All the other URL paths will be routed to the instance group web:
Getting ready
The following are the initial setup verifications to be carried out before the...