-
Notifications
You must be signed in to change notification settings - Fork 11
Add GZip compression to HAProxy config file #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Maybe we should add a minimum file size as described here in their documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds GZip compression to the HAProxy configuration for the Manager backend to reduce download sizes for web assets. Testing shows the Manager UI bundle size decreased from 6.5MB to approximately 2.7MB. The change adds compression directives to the manager_backend section of the HAProxy configuration.
Changes:
- Adds GZip compression configuration to the
manager_backendin HAProxy - Configures compression for HTML, CSS, JavaScript, JSON, and SVG MIME types
- Sets minimum response size of 1500 bytes for compression eligibility
- Enables compression offload to prevent double compression
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
haproxy.cfg
Outdated
| backend manager_backend | ||
| compression algo gzip deflate # Enable compression | ||
| compression type text/html text/css application/javascript application/json image/svg+xml | ||
| compression minsize-res 1500 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running the proxy image with the updated haproxy.cfg, results in the following error:
[NOTICE] (20) : haproxy version is 2.9.15-e872a3f
[ALERT] (20) : config : parsing [/etc/haproxy/haproxy.cfg:148] : 'compression' expects 'algo', 'type' 'direction' or 'offload'
[ALERT] (20) : config : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
[ALERT] (20) : config : Fatal errors found in configuration.
[ERROR][2026-02-03 16:46:47] Cannot start proxy until config file errors are resolved in '/etc/haproxy/haproxy.cfg'Removing the following line resolves it.
compression minsize-res 1500
minsize-res was added in HAProxy version 3.2, see https://www.haproxy.com/documentation/haproxy-configuration-tutorials/performance/compression/#set-a-minimum-file-size
We are currently using version 2.9. It might be OK to remove the minsize, or maybe try bumping the version to 3.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
Maybe we should indeed create an issue for doing the upgrade.
I'll remove that minsize-res line for this PR 👍
|
Thanks for the review @dominiquekleeven , good catch there 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| compression algo gzip deflate # Enable compression | ||
| compression type text/html text/css application/javascript application/json image/svg+xml | ||
| compression offload |
Copilot
AI
Feb 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compression configuration is only applied to the manager_backend but not to the keycloak_backend at line 154. If the Keycloak backend also serves compressible content (HTML, CSS, JavaScript, JSON), it should also benefit from compression. Consider whether compression should be applied consistently across all backends or if there's a specific reason to exclude Keycloak.
Description
Fixes #13
As a simple test, I tried out this HAProxy config locally to experiment if the Manager UI would load properly.
I'm not an expert in HAProxy nor any proxy application, so it was just a simple attempt 😉
I looked at the official documentation, and made adjustments based on that.
It seems to correctly apply the GZip compression, and significantly reduce the download sizes.
For example, the Manager UI bundle went down from 6.5MB to about 2.7MB.
Any feedback on this is welcome 👍
Changelog