This repository provides a production-ready HAProxy Docker image and Pterodactyl Egg for easy reverse-proxying, load balancing, and high-availability setups directly from your Pterodactyl panel.
This egg is heavily optimized for Minecraft Server routing (Java Edition).
- Minecraft Optimized: Pre-configured with long TCP timeouts (
12h) to prevent players from timing out during large resource pack downloads or server lag spikes. - Proxy Protocol Support: Built-in toggle to enable
send-proxy-v2, allowing backend servers (Velocity, BungeeCord, Paper) to see real player IPs. - Alpine Based: Extremely lightweight Docker image based on
haproxy:alpine. - Non-Root Execution: Runs securely as the
containeruser. - Auto-Installation: Automatically generates a functional boilerplate
haproxy.cfgwhen the server is installed. - Multi-Architecture: Supports both
amd64andarm64systems.
Warning
No UDP Proxying HAProxy is a TCP proxy. It cannot proxy UDP traffic. Therefore, this egg works perfectly for Minecraft Java Edition, but it cannot be used to proxy Bedrock/Geyser traffic.
When using this egg to proxy traffic to a Minecraft network (like Velocity or BungeeCord):
- Backend Host / Port: Set these variables to the IP and Port of your Velocity/BungeeCord proxy.
- Enable Proxy Protocol: Set this variable to
1. This will automatically appendsend-proxy-v2to your HAProxy configuration during installation. - Backend Setup: Ensure your backend proxy (e.g., Velocity) is configured to accept HAProxy connections. In
velocity.toml, sethaproxy-protocol = true.
- Download the
egg-h-a-proxy.jsonfile from this repository. - In your Pterodactyl Admin Panel, go to Nests -> Import Egg.
- Select the
egg-h-a-proxy.jsonfile and assign it to a Nest of your choice. - When creating a new server, simply select the HAProxy egg.
- During creation, configure the Backend Host, Backend Port, and Proxy Protocol settings.
Upon installation, a default haproxy.cfg is generated in your server's root directory. It automatically reads your server's assigned port (${SERVER_PORT}) and routes traffic to the backend host and port you defined (${BACKEND_HOST}:${BACKEND_PORT}).
You can customize haproxy.cfg freely to utilize HAProxy's advanced features, such as multiple frontends/backends, SSL termination, or complex load-balancing algorithms. Note: The proxy protocol variable only affects the configuration generated during the initial install. If you need to enable it later, you must manually add send-proxy-v2 to your haproxy.cfg.
If you wish to build the Docker image yourself instead of using the provided GitHub Container Registry image:
docker build -t your-registry/haproxy-pterodactyl:latest .