External Application Load Balancer overview

This document introduces the concepts that you need to understand how to configure an external Application Load Balancer.

An external Application Load Balancer is a proxy-based Layer 7 load balancer that enables you to run and scale your services behind a single external IP address. The external Application Load Balancer distributes HTTP and HTTPS traffic to backends hosted on a variety of Google Cloud platforms (such as Compute Engine, Google Kubernetes Engine (GKE), and Cloud Storage), as well as external backends connected over the internet or through hybrid connectivity. For details, see Application Load Balancer overview: Use cases.

Modes of operation

You can configure an external Application Load Balancer in the following modes:

  • Global external Application Load Balancer. This is a global load balancer that is implemented as a managed service on Google Front Ends (GFEs). It uses the open-source Envoy proxy to support advanced traffic management capabilities such as traffic mirroring, weight-based traffic splitting, and request-based or response-based header transformations.
  • Classic Application Load Balancer. This is the classic external Application Load Balancer that is global in Premium Tier but can be configured to be regional in Standard Tier. This load balancer is implemented on Google Front Ends (GFEs). GFEs are distributed globally and operate together using Google's global network and control plane.
  • Regional external Application Load Balancer. This is a regional load balancer that is implemented as a managed service on the open-source Envoy proxy. It includes advanced traffic management capabilities such as traffic mirroring, weight-based traffic splitting, and request-based or response-based header transformations.
Load balancer mode Recommended use cases Capabilities
Global external Application Load Balancer Use this load balancer for external HTTP(S) workloads with globally dispersed users or backend services in multiple regions.
Classic Application Load Balancer

This load balancer is global in Premium Tier. In the Premium Network Service Tier, this load balancer offers multi-region load balancing, attempts to direct traffic to the closest healthy backend that has capacity, and terminates HTTP(S) traffic as close as possible to your users. For details about the request distribution process, see Traffic distribution.

In the Standard Network Service Tier, this load balancer can distribute traffic to backends in a single region only.

  • Compatible with GKE using Gateway (fully orchestrated), Ingress (fully orchestrated), or Standalone NEGs (manual orchestration)
  • Supports Google Cloud Armor
  • Fewer traffic routing features
See the Load balancing features page for the full list of capabilities.
Regional external Application Load Balancer

This load balancer contains many of the features of the existing classic Application Load Balancer, along with advanced traffic management capabilities.

Use this load balancer if you want to serve content from only one geolocation (for example, to meet compliance regulations).

This load balancer can be configured in either Premium or Standard Tier.

For the complete list, see Load balancing features.

Identify the mode

Console

  1. In the Google Cloud console, go to the Load balancing page.

    Go to Load balancing

  2. In the Load Balancers tab, the load balancer type, protocol, and region are displayed. If the region is blank, then the load balancer is global. The following table summarizes how to identify the mode of the load balancer.

Load balancer mode Load balancer type Access type Region
Global external Application Load Balancer Application External
Classic Application Load Balancer Application (Classic) External
Regional external Application Load Balancer Application External Specifies a region

gcloud

To determine the mode of a load balancer, run the following command:

   gcloud compute forwarding-rules describe FORWARDING_RULE_NAME
   

In the command output, check the load balancing scheme, region, and network tier. The following table summarizes how to identify the mode of the load balancer.

Load balancer mode Load balancing scheme Forwarding rule Network tier
Global external Application Load Balancer EXTERNAL_MANAGED Global Premium
Classic Application Load Balancer EXTERNAL Global Standard or Premium
Regional external Application Load Balancer EXTERNAL_MANAGED Specifies a region Standard or Premium

Architecture

The following resources are required for an external Application Load Balancer deployment:

  • For regional external Application Load Balancers only, a proxy-only subnet is used to send connections from the load balancer to the backends.

  • An external forwarding rule specifies an external IP address, port, and target HTTP(S) proxy. Clients use the IP address and port to connect to the load balancer.

  • A target HTTP(S) proxy receives a request from the client. The HTTP(S) proxy evaluates the request by using the URL map to make traffic routing decisions. The proxy can also authenticate communications by using SSL certificates.

    • For HTTPS load balancing, the target HTTPS proxy uses SSL certificates to prove its identity to clients. A target HTTPS proxy supports up to the documented number of SSL certificates.
  • The HTTP(S) proxy uses a URL map to make a routing determination based on HTTP attributes (such as the request path, cookies, or headers). Based on the routing decision, the proxy forwards client requests to specific backend services or backend buckets. The URL map can specify additional actions, such as sending redirects to clients.

  • A backend service distributes requests to healthy backends. The global external Application Load Balancers also support backend buckets. One or more backends must be connected to the backend service or backend bucket.

  • A health check periodically monitors the readiness of your backends. This reduces the risk that requests might be sent to backends that can't service the request.

  • Firewall rules for your backends to accept health check probes. Regional external Application Load Balancers require an additional firewall rule to allow traffic from the proxy-only subnet to reach the backends.

Global

This diagram shows the components of a global external Application Load Balancer deployment. This architecture applies to both, the global external Application Load Balancer, and the classic Application Load Balancer in Premium Tier.

Global external Application Load Balancer components.
Global external Application Load Balancer components (click to enlarge).
Regional

This diagram shows the components of a regional external Application Load Balancer deployment.

Regional external Application Load Balancer components.
Regional external Application Load Balancer components (click to enlarge).

Proxy-only subnet

Proxy-only subnets are only required for regional external Application Load Balancers.

The proxy-only subnet provides a set of IP addresses that Google uses to run Envoy proxies on your behalf. You must create one proxy-only subnet in each region of a VPC network where you use regional external Application Load Balancers. The --purpose flag for this proxy-only subnet is set to REGIONAL_MANAGED_PROXY. All regional Envoy-based load balancers in the same region and VPC network share a pool of Envoy proxies from the same proxy-only subnet. Further:

  • Proxy-only subnets are only used for Envoy proxies, not your backends.
  • Backend VMs or endpoints of all regional external Application Load Balancers in a region and VPC network receive connections from the proxy-only subnet.
  • The IP address of the regional external Application Load Balancer is not located in the proxy-only subnet. The load balancer's IP address is defined by its external managed forwarding rule, which is described below.
  • Proxy-only subnets can be configured with a stack type of IPV4_IPV6 or IPV4_ONLY.

If you previously created a proxy-only subnet with --purpose=INTERNAL_HTTPS_LOAD_BALANCER, migrate the subnet's purpose to REGIONAL_MANAGED_PROXY before you can create other Envoy-based load balancers in the same region of the VPC network.

Forwarding rules and IP addresses

Forwarding rules route traffic by IP address, port, and protocol to a load balancing configuration consisting of a target proxy, URL map, and one or more backend services.

IP address specification. Each forwarding rule provides a single IP address that can be used in DNS records for your application. No DNS-based load balancing is required. You can either specify the IPv4 or IPv6 address to be used or let Cloud Load Balancing assign one for you.

Port specification. Each forwarding rule for an Application Load Balancer can reference a single port from 1-65535. To support multiple ports, you must configure multiple forwarding rules. You can configure multiple forwarding rules to use the same external IP address (VIP) and to reference the same target HTTP(S) proxy as long as the overall combination of IP address, port, and protocol is unique for each forwarding rule. This way, you can use a single load balancer with a shared URL map as a proxy for multiple applications.

The type of forwarding rule, IP address, and load balancing scheme used by external Application Load Balancers depends on the mode of the load balancer and which Network Service Tier the load balancer is in.

Load balancer mode Network Service Tier Forwarding rule, IP address, and load balancing scheme Routing from the internet to the load balancer frontend
Global external Application Load Balancer Premium Tier

Global external forwarding rule

Global external IP address

Load balancing scheme:
EXTERNAL_MANAGED

Requests routed to the GFE that is closest to the client on the internet.
Classic Application Load Balancer Premium Tier

Global external forwarding rule

Global external IP address

Load balancing scheme:
EXTERNAL 1

Requests routed to the GFE that is closest to the client on the internet.
Standard Tier

Regional external forwarding rule

Regional external IP address

Load balancing scheme:
EXTERNAL1

Requests routed to a GFE in the load balancer's region.
Regional external Application Load Balancer Premium Tier or Standard Tier

Regional external forwarding rule

Regional external IP address

Load balancing scheme:
EXTERNAL_MANAGED

Requests reach Google Cloud at the PoP closest to the client. Requests are then routed over Google Cloud's premium backbone until they reach Envoy proxies in the same region as the load balancer.
1 It is possible to attach EXTERNAL_MANAGED backend services to EXTERNAL forwarding rules. However, EXTERNAL backend services cannot be attached to EXTERNAL_MANAGED forwarding rules. To take advantage of new features available only with the global external Application Load Balancer, we recommend that you migrate your existing EXTERNAL resources to EXTERNAL_MANAGED by using the migration process described at Migrate resources from classic to global external Application Load Balancer.

For the complete list of protocols supported by external Application Load Balancer forwarding rules in each mode, see Load balancer features.

Forwarding rules and VPC networks

This section describes how forwarding rules used by external Application Load Balancers are associated with VPC networks.

Load balancer mode VPC network association
Global external Application Load Balancer

Classic Application Load Balancer

No associated VPC network.

The forwarding rule always uses an IP address that is outside the VPC network. Therefore, the forwarding rule has no associated VPC network.

Regional external Application Load Balancer

The forwarding rule's VPC network is the network where the proxy-only subnet has been created. You specify the network when you create the forwarding rule.

Depending on whether you use an IPv4 address or an IPv6 address range, there is always an explicit or implicit VPC network associated with the forwarding rule.

  • Regional external IPv4 addresses always exist outside of VPC networks. However, when you create the forwarding rule, you're required to specify the VPC network where the proxy-only subnet has been created. Therefore, the forwarding rule has an explicit network association.
  • Regional external IPv6 address ranges always exist inside a VPC network. When you create the forwarding rule, you're required to specify the subnet from which the IP address range is taken. This subnet must be in the same region and VPC network where a proxy-only subnet has been created. Thus, there is an implied network association.

    Network and subnet requirements. For IPv6 traffic, your network and subnets must meet the following configuration requirements:

    • VPC network: you must use a custom mode VPC network configured with the --enable-ula-internal-ipv6 flag.
    • Forwarding rule subnet: this subnet must be a dual-stack (IPv4_IPv6) or IPV6_ONLY subnet with the ipv6-access-type set to EXTERNAL.

    IPv6 address allocation options. The forwarding rule must reference a /96 range of IPv6 addresses from the subnet's /64 external IPv6 address range.

    Limitations. To specify a custom ephemeral IPv6 address, you must use the Google Cloud CLI or the API. The Google Cloud console doesn't support specifying custom ephemeral IPv6 addresses for forwarding rules.

Target proxies

Target proxies terminate HTTP(S) connections from clients. One or more forwarding rules direct traffic to the target proxy, and the target proxy consults the URL map to determine how to route traffic to backends.

Do not rely on the proxy to preserve the case of request or response header names. For example, a Server: Apache/1.0 response header might appear at the client as server: Apache/1.0.

The following table specifies the type of target proxy required by external Application Load Balancers.

Load balancer mode Target proxy types Proxy-added headers Custom headers supported
Global external Application Load Balancer Global HTTP,
Global HTTPS
The proxies set HTTP request/response headers as follows:
  • Via: 1.1 google (requests and responses)
  • X-Forwarded-Proto: [http | https] (requests only)
  • X-Forwarded-For: [<supplied-value>,]<client-ip>,<load-balancer-ip> (see X-Forwarded-For header) (requests only)

The proxies also set the X-Cloud-Trace-Context header if it is not already present.

Configured on the backend service or backend bucket

Not supported with Cloud CDN

Classic Application Load Balancer Global HTTP,
Global HTTPS
The proxies set HTTP request/response headers as follows:
  • Via: 1.1 google (requests and responses)
  • X-Forwarded-Proto: [http | https] (requests only)
  • X-Forwarded-For: [<supplied-value>,]<client-ip>,<load-balancer-ip> (see X-Forwarded-For header) (requests only)

The proxies also set the X-Cloud-Trace-Context header if it is not already present.

Configured on the backend service or backend bucket
Regional external Application Load Balancer Regional HTTP,
Regional HTTPS
  • X-Forwarded-Proto: [http | https] (requests only)
  • Via: 1.1 google (requests and responses)
  • X-Forwarded-For: [<supplied-value>,]<client-ip>,<load-balancer-ip> (see X-Forwarded-For header) (requests only)
Configured in the URL map

In addition to headers added by the target proxy, the load balancer adjusts other HTTP headers in the following ways:

  • For the global external Application Load Balancer, both request and response headers might be converted to lowercase.

    The only exception to this is when you use global internet NEG backends with HTTP/1.1. For details about how HTTP/1.1 headers are processed with global internet NEGs, see the Internet NEGs overview.

  • For the classic Application Load Balancer, request and response headers are converted to lowercase except when you use HTTP/1.1. With HTTP/1.1, headers are proper-cased instead. The first letter of the header's key and every letter following a hyphen (-) is capitalized to preserve compatibility with HTTP/1.1 clients. For example, user-agent is changed to User-Agent, and content-encoding is changed to Content-Encoding.

  • Some headers are coalesced. When there are multiple instances of the same header key (for example, Via), the load balancer combines their values into a single comma-separated list for a single header key. Only the headers whose values can be represented as a comma-separated list are coalesced. Other headers, such as Set-Cookie, are never coalesced.

Host header

When the load balancer makes the HTTP request, the load balancer preserves the Host header of the original request.

X-Forwarded-For header

The load balancer appends two IP addresses to the X-Forwarded-For header, separated by a single comma, in the following order:

  1. The IP address of the client that connects to the load balancer
  2. The IP address of the load balancer's forwarding rule

If the incoming request does not include an X-Forwarded-For header, the resulting header is as follows:

X-Forwarded-For: <client-ip>,<load-balancer-ip>

If the incoming request already includes an X-Forwarded-For header, the load balancer appends its values to the existing header:

X-Forwarded-For: <existing-value>,<client-ip>,<load-balancer-ip>

Remove existing header values using a custom request header

It is possible to remove existing header values by using custom request headers on the backend service. The following example uses the --custom-request-header flag to recreate the X-Forwarded-For header by using the variables client_ip_address and server_ip_address. This configuration replaces the incoming X-Forwarded-For header with only the client and the load balancer IP address.

--custom-request-header=x-forwarded-for:{client_ip_address},{server_ip_address}

How backend reverse proxy software might modify the X-Forwarded-For header

If your load balancer's backends run HTTP reverse proxy software, the software might append one or both of the following IP addresses to the end of the X-Forwarded-For header:

  1. The IP address of the GFE that connected to the backend. The GFE proxy ranges are listed in the Firewall rules document.

  2. The IP address of the backend system itself.

As a result, an upstream system might see an X-Forwarded-For header structured as follows:

<existing-value>,<client-ip>,<load-balancer-ip>,<GFE-ip>,<backend-ip>

Cloud Trace support

Trace is not supported with Application Load Balancers. The global and classic Application Load Balancers add the X-Cloud-Trace-Context header if it is not present. The regional external Application Load Balancer does not add this header. If the X-Cloud-Trace-Context header is already present, it passes through the load balancers unmodified. However, no traces or spans are exported by the load balancer.

URL maps

URL maps define matching patterns for URL-based routing of requests to the appropriate backend services. The URL map allows you to divide your traffic by examining the URL components to send requests to different sets of backends. A default service is defined to handle any requests that don't match a specified host rule or path matching rule.

In some situations, such as the multi-region load balancing example, you might not define any URL rules and rely only on the default service.

URL maps support several advanced traffic management features such as header-based traffic steering, weight-based traffic splitting, and request mirroring. For more information, see the following:

The following table specifies the type of URL map required by external Application Load Balancers in each mode.

Load balancer mode URL map type
Global external Application Load Balancer Global
Classic Application Load Balancer Global (with only a subset of the features supported)
Regional external Application Load Balancer Regional

SSL certificates

External Application Load Balancers using target HTTPS proxies require private keys and SSL certificates as part of the load balancer configuration.

  • Google Cloud provides two configuration methods for assigning private keys and SSL certificates to target HTTPS proxies: Compute Engine SSL certificates and Certificate Manager. For a description of each configuration, see Certificate configuration methods in the SSL certificates overview.

  • Google Cloud provides two certificate types: Self-managed and Google-managed. For a description of each type, see Certificate types in the SSL certificates overview.

The type of external Application Load Balancer (global, regional, or classic) determines which configuration methods and certificate types are supported. For details, see