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.
The client connects to your application at the configured public IP address. The load balancer listens at that address and receives the packets.
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.
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:
-
In the web UI's LB Layer7 tab, set the
mode
directive tohttp
in both thefrontend
andbackend
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
Click on the Setup tab. In the Configuration section, click Save.
Enable HTTP/2
-
To enable HTTP/2 between clients and HAProxy ALOHA, configure a
bind
line in yourfrontend
section as anssl
endpoint. Thealpn
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.crtalpn h2,http/1.1 # Redirect HTTP to HTTPS http-request redirect scheme https unless { ssl_fc } default_backend serversTo enable HTTP/2 between HAProxy ALOHA and your backend servers, add the
alpn
parameter to yourserver
ordefault-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.
Click on the Setup tab. In the Configuration section, click Save.
Next up
TCP