Learn how to enable HTTP2 on HAProxy. Our HAProxy Support team is here to help you with your questions and concerns.
How to Enable HTTP2 on HAProxy
If you’re a user of HAProxy, it is worth exploring the benefits of HTTP/2 support. Our experts are here to guide you through the process of enabling HTTP/2 on both the server and client sides of HAProxy.
- Before we begin, we have to make sure ensure that the correct version of HAProxy is installed on the server. Since HAProxy introduced support for HTTP/2 on the server side starting from version 2.0 and on the client side from version 2.2, our HAProxy installation has to be at least version 2.2. We can check this with the following command:
haproxy -v
In case our version is below 2.2, we have to upgrade it before moving on to the next step.
- Then, get ready to modify the configuration file located at /etc/haproxy/haproxy.cfg.
sudo nano /etc/haproxy/haproxy.cfg
- Now, head to the ‘defaults’ section in the file and add this line to enable HTTP/2 on the server side:
option http-use-htx
- Then, head to the ‘frontend’ or ‘listen’ section and replace ‘mode http’ with ‘mode http’ and ‘http/1.1’ with ‘http/2’. This will enable HTTP/2 on the client side:
bind *:443 ssl crt /etc/ssl/private/website.pem alpn h2,http/1.1
We have to replace ‘/etc/ssl/private/website.pem’ with the path to our SSL certificate.
- Now, save and close the file. Then, restart HAProxy to apply the changes.
- We can check if HAProxy is running correctly with this command:
sudo systemctl status haproxy
- Now, it is time to confirm that HTTP/2 is functioning correctly with an online HTTP/2 test tool like the one at KeyCDN. All we have to do is enter the URL into the tool, and it will verify whether HTTP/2 is enabled.
Older Versions of HAProxy
Our experts would like to point out that older versions of HAProxy (for example 1.6 and 1.7) support pass-through HTTP/2. In other words, it directs traffic to a separate app server that supports HTTP/2. However, this can get complicated. To stop HTTP/2 and read the traffic on HAProxy, we need version 1.8 or above.
At the end of the day, enabling HTTP/2 on HAProxy enhances the performance and efficiency of our web server.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
In brief, our Support Experts demonstrated how to enable HTTP2 on HAProxy.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments