HAProxy ALOHA Documentation 14.5

HTTP

HAProxy ALOHA can operate as an HTTP proxy, in which HTTP streams are relayed through the load balancer to a pool of backend servers.

  1. The client connects to your application at the configured public IP address. The load balancer listens at that address and receives the packets.

  2. The load balancer makes a separate connection to one of the backend servers and relays the packets over that connection. In other words, the client's original connection is not routed to a backend server directly. Instead, the client communicates with the load balancer only.

  3. The backend server sends its response back to the load balancer which relays it back to the client over the frontend connection.

HTTP load balancing is configured using the layer 7 load balancer via the LB Layer7 tab.

Set HTTP mode

To load balance HTTP connections:

  1. In the web UI's LB Layer7 tab, set the mode directive to http in both the frontend and backend sections of your configuration.

    Set the mode to http to load balance HTTP traffic.

    frontend webservice
      mode http
      bind :80
      default_backend webfarm
    
    backend webfarm
      mode http
      balance roundrobin
      server  websrv1 192.168.1.21:80
      server  websrv2 192.168.1.22:80
  2. Click on the Setup tab. In the Configuration section, click Save.

Enable HTTP/2

  1. To enable HTTP/2 between clients and HAProxy ALOHA, configure a bind line in your frontend section as an ssl endpoint. The alpn parameter announces that the load balancer supports HTTP/2 (h2) as its first choice and HTTP/1.1 as a backup by listing them in that order.

    frontend www
       mode http
       bind :80
       bind :443 ssl crt /path/to/cert.crt alpn h2,http/1.1
    
       # Redirect HTTP to HTTPS
       http-request redirect scheme https unless { ssl_fc }
    
       default_backend servers

    To enable HTTP/2 between HAProxy ALOHA and your backend servers, add the alpn parameter to your server or default-server lines:

    backend servers
       mode http
       server s1 192.168.0.10:443 ssl alpn h2,http/1.1
       server s2 192.168.0.11:443 ssl alpn h2,http/1.1

    This announces to the servers that HAProxy ALOHA, acting as a client, supports HTTP/2. The servers must also support it.

  2. Click on the Setup tab. In the Configuration section, click Save.


Next up

TCP