Traefik

devops

Cloud-native reverse proxy and load balancer that auto-discovers services from Docker and Kubernetes labels. Handles SSL certificate provisioning and routing with no manual config file updates

#reverse-proxy#load-balancer#docker#networking#ssl#self-hosted
Alternative to NginxHAProxyCaddy

Quick Start

docker run -d -p 80:80 -p 443:443 -p 8080:8080 -v /var/run/docker.sock:/var/run/docker.sock traefik:v3.3 --api.insecure=true --providers.docker

Overview

Traefik is a reverse proxy built for environments where services come and go. Rather than maintaining a static config file, it reads Docker labels or Kubernetes annotations on your containers and generates routing rules on the fly. Deploy a new container with the right labels and Traefik picks it up immediately, without a reload, without editing a file, without a restart.

SSL certificate management is handled automatically through Let’s Encrypt. Add a traefik.http.routers.myapp.tls.certresolver=letsencrypt label to a container, point your DNS to the server, and Traefik requests and renews the certificate. It works for wildcard certificates too, using DNS challenge providers for domains that don’t have a public HTTP endpoint.

The middleware system is where Traefik earns its place in more complex setups. You can attach rate limiting, HTTP basic auth, redirect chains, IP allowlists, and header manipulation to any route through labels, without modifying the service itself. This is useful for adding access controls to tools like Portainer or Grafana that you want behind authentication but don’t want to duplicate auth logic across every service.

The dashboard provides a live view of all routers, services, and middlewares with current health status. It is read-only, but useful for debugging routing mismatches.

The main friction point is the learning curve. Traefik’s label-based syntax is its own system, and a misplaced label produces a silent failure rather than a clear error. For teams running a handful of Docker services, Caddy or Nginx Proxy Manager may be simpler starting points. For anyone managing a growing set of containerised services or planning to move to Kubernetes, Traefik’s auto-discovery model pays back the upfront learning cost.

Traefik: Pros & Cons

Pros (The Wins)Cons (The Friction)
Auto-discovery:
Docker labels generate routes
without config file edits.
Learning curve:
Label syntax is Traefik-specific;
debugging silent failures is hard.
Automatic SSL:
Let’s Encrypt certs provisioned
and renewed per-service.
Overkill for simple setups:
Caddy is faster to configure
for basic reverse proxy needs.
Middleware system:
Auth, rate limiting, redirects
attached via labels per-service.
Enterprise features gated:
Some advanced plugins require
the commercial edition.
63.3k stars:
Standard choice for Docker
Compose self-hosted stacks.
Dynamic config debugging:
Mismatched labels fail silently
with no obvious error output.

Use Cases

Specific ways to use Traefik for your workflow.

01
Automatically route traffic to new Docker containers without editing a config file each time you deploy
02
Provision and renew Let's Encrypt SSL certificates for every service without manual certificate management
03
Load balance across multiple instances of a containerised service with health checks and automatic failover
04
Add HTTP authentication or rate limiting to services that don't have their own access controls

Deployment Strategy

Recommended ways to host Traefik in your own environment.

docker
self-hosted