Traefik vs HAProxy: Reverse Proxy Showdown

Quick Verdict

Traefik is the better choice for most self-hosters. It auto-discovers Docker containers via labels, handles Let’s Encrypt certificates automatically, and requires no config file editing when you add new services. HAProxy is the better choice if you need production-grade load balancing, TCP proxying, advanced health checks, or stick-table-based rate limiting — but that level of power is rarely needed in a homelab.

Overview

Traefik (v3.6) is a cloud-native edge router that watches Docker, Kubernetes, and other providers for service changes. When you deploy a new container with the right labels, Traefik automatically creates a route and provisions an SSL certificate. Configuration is split between a static config file (entry points, providers) and dynamic config (Docker labels on each service).

HAProxy (v3.3) is a high-performance TCP/HTTP load balancer used by GitHub, Reddit, and Stack Overflow. It is configured entirely through a single config file (haproxy.cfg) with no auto-discovery. HAProxy’s strength is its load balancing algorithms, health checks, stick tables, and TCP-level proxying capabilities.

Both are open source, high-performance, and written in different languages (Traefik in Go, HAProxy in C). They target different workflows: Traefik is container-native, HAProxy is infrastructure-native.

Feature Comparison

FeatureTraefik (v3.6)HAProxy (v3.3)
Auto service discoveryYes — Docker, Swarm, K8s, ConsulNo — manual config only
Configuration methodDocker labels + YAML static configSingle config file (haproxy.cfg)
Automatic HTTPSYes — Let’s Encrypt built-inNo — external ACME client needed
Load balancing algorithmsRound robin, weighted, stickyRound robin, least connections, source, URI, random, power-of-two
Health checksYes — automaticYes — advanced (HTTP content checks, TCP, custom scripts)
TCP/UDP proxyingYesYes — more mature, battle-tested
Stick tables (session persistence)Basic — cookie-basedAdvanced — IP, cookie, URL, custom keys with counters
Rate limitingVia middlewareNative — stick tables with request rate tracking
Web dashboardYes — read-onlyYes — stats page with real-time metrics
HTTP/2YesYes
HTTP/3 (QUIC)YesNot yet (planned)
Middleware ecosystem30+ built-inLimited — ACLs and http-request rules
Docker Swarm supportYes — nativeNo
Kubernetes supportYes — IngressRoute CRDYes — Kubernetes Ingress Controller (separate project)
MetricsPrometheus, OpenTelemetryPrometheus exporter, stats socket
Config reloadHot reload (label changes detected)Graceful reload via SIGHUP
LicenseMITGPL v2 (FOSS), HAProxy Technologies License (Enterprise)

Installation Complexity

Traefik requires more initial setup than it first appears. You need a static config file defining entry points and certificate resolvers, then Docker labels on every service you want to proxy. But once set up, adding new services is trivial — just add labels to the container’s Compose file.

HAProxy has a steeper config learning curve. The haproxy.cfg file uses a custom syntax with global, defaults, frontend, and backend sections. Adding a new service means editing the config file and sending SIGHUP to reload. There is no auto-discovery. But the config format is well-documented and predictable.

For a homelab that changes frequently (adding/removing containers), Traefik’s auto-discovery saves significant time. For a stable setup that rarely changes, HAProxy’s explicit config is equally manageable.

Performance and Resource Usage

MetricTraefikHAProxy
Idle RAM~80-120 MB~15-30 MB
Under load RAM~200-400 MB~50-100 MB
Latency overheadVery lowExtremely low (C, event-driven)
Max concurrent connectionsHighVery high (designed for 100K+ concurrent)
Docker image size~130 MB~100 MB

HAProxy is significantly lighter and faster. Written in C with an event-driven architecture, it is designed for extreme concurrency. Traefik’s Go runtime and service discovery watchers consume more memory. For a homelab, this difference is negligible. For production load balancing at scale, HAProxy’s efficiency matters.

Community and Support

MetricTraefikHAProxy
GitHub stars53K+5K+ (lower because it predates GitHub)
First release20162001
DocumentationGood, modern docs siteExcellent, comprehensive reference
Commercial supportTraefik EnterpriseHAProxy Technologies (Enterprise + ALOHA)
CommunityForums, Discord, RedditMailing list, Discourse, IRC

HAProxy has 15 years more history and is the foundation of internet infrastructure. Traefik has a larger GitHub presence because it is container-native and attracts the Docker/Kubernetes community. Both have strong commercial offerings.

Use Cases

Choose Traefik If…

  • You run Docker containers and want automatic routing via labels
  • You want built-in Let’s Encrypt without an external ACME client
  • You deploy on Docker Swarm or Kubernetes
  • You add and remove services frequently
  • You want middleware (authentication, rate limiting, headers) configurable per-route via labels
  • You prefer config-as-code where routing lives with the service definition

Choose HAProxy If…

  • You need production-grade load balancing across multiple backend servers
  • You proxy TCP traffic (databases, MQTT, game servers)
  • You need advanced health checks (HTTP content matching, TCP checks, scripts)
  • You need stick-table-based rate limiting and DDoS protection
  • Maximum performance and minimal overhead are critical
  • You run bare-metal or VM infrastructure without Docker

FAQ

Can HAProxy auto-discover Docker containers?

Not natively. There are third-party tools like docker-gen that can generate HAProxy configs from container labels, but this is not built-in and not as reliable as Traefik’s native provider.

Which handles more traffic?

HAProxy, by a significant margin. It is designed for 100K+ concurrent connections and is used by some of the largest websites. Traefik handles homelab and medium-scale traffic without issues but is not in the same class for extreme load.

Can I migrate from one to the other?

Routes do not transfer. Traefik uses Docker labels; HAProxy uses haproxy.cfg. You would rewrite your routing config in the target format. SSL certificates via Let’s Encrypt will be re-provisioned automatically by Traefik; HAProxy requires manual certificate management regardless.

Final Verdict

Traefik wins for self-hosting. Auto-discovery, built-in HTTPS, and Docker-native integration make it the practical choice for homelabs and small-scale deployments. Adding a new service is two Docker labels instead of editing a config file and reloading.

HAProxy wins in a different arena: production infrastructure, high-traffic load balancing, and TCP proxying. If you are running a cluster of web servers behind a load balancer, HAProxy is the industry standard. But most self-hosters are running a single server with 5-30 services, and Traefik handles that better.