Last active
July 10, 2025 21:23
-
-
Save andrewchilds/2393d6017c0b4a6e79d635243804fd12 to your computer and use it in GitHub Desktop.
Revisions
-
andrewchilds revised this gist
Jun 27, 2023 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,8 +2,6 @@ This was tested to work using HAProxy 2.8 on Ubuntu 20.04. ### Use case This lets you run a cluster of API servers configured to use HTTP/2 (for example, Fastify using `{ http2: true }`), behind a HAProxy LB, so that you can serve typical REST API requests as well as SSE (Server Side Events) streaming connections, so that you can do fancy real-time page updates in your app. -
andrewchilds revised this gist
Jun 27, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,6 @@ I'm not sure if `mode http` is a necessary line or not. ### Use case This lets you run a cluster of API servers configured to use HTTP/2 (for example, Fastify using `{ http2: true }`), behind a HAProxy LB, so that you can serve typical REST API requests as well as SSE (Server Side Events) streaming connections, so that you can do fancy real-time page updates in your app. Using HTTP/2 resolves the "6 concurrent HTTP connections" limit imposed by Chrome/Firefox/etc, which means the web app would become unresponsive if the user has 6+ tabs open with the app simultaneously. -
andrewchilds revised this gist
Jun 22, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,6 @@ I'm not sure if `mode http` is a necessary line or not. ### Use case This lets you run a cluster of API servers running Fastify, configured to use HTTP/2 (`{ http2: true }`), behind a HAProxy LB, so that you can serve typical REST API requests as well as SSE (Server Side Events) streaming connections, so that you can do fancy real-time page updates in your app. Using HTTP/2 resolves the "6 concurrent HTTP connections" limit imposed by Chrome/Firefox/etc, which means the web app would become unresponsive if the user has 6+ tabs open with the app simultaneously. -
andrewchilds created this gist
Jun 22, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ ## How to configure HAProxy to support end-to-end (e2e) connections that switch from h2 to h2c This was tested to work using HAProxy 2.8 on Ubuntu 20.04. I'm not sure if `mode http` is a necessary line or not. ### Use case This allows me to run a cluster of API servers running Fastify, configured to use HTTP/2 (`{ http2: true }`), behind a HAProxy LB, to allow me to serve typical REST API requests as well as SSE (Server Side Events) stream connections. Using HTTP/2 resolves the "6 concurrent HTTP connections" limit imposed by Chrome/Firefox/etc, which means the web app would become unresponsive if the user has 6+ tabs open with the app simultaneously. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ frontend http_front mode http bind *:80 bind *:443 ssl crt /etc/haproxy/ssl/YOURDOMAIN.pem alpn h2,http/1.1 redirect scheme https if !{ ssl_fc } default_backend http_back backend http_back mode http balance roundrobin server api1 1.2.3.4:4000 proto h2 check server api2 1.2.3.5:4000 proto h2 check