Traefik is a free, open-source reverse proxy and load balancer designed for cloud-native environments. It automatically discovers services and configures itself.
What Is Traefik?
Traefik is a modern reverse proxy that integrates with your existing infrastructure. It automatically discovers services from Docker, Kubernetes, and other providers — no manual configuration needed.
Key features:
- Auto-discovery of services (Docker, K8s, etc.)
- Automatic HTTPS with Let's Encrypt
- Load balancing (round-robin, weighted, sticky sessions)
- Middleware (rate limiting, auth, headers, compression)
- Dashboard for monitoring
- Canary deployments and traffic mirroring
- TCP/UDP support
- gRPC support
- WebSocket support
Quick Start with Docker
# docker-compose.yml
services:
traefik:
image: traefik:v3.2
command:
- --api.dashboard=true
- --providers.docker=true
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --certificatesresolvers.letsencrypt.acme.email=you@email.com
- --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
- --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web
ports:
- 80:80
- 443:443
- 8080:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- letsencrypt:/letsencrypt
myapp:
image: nginx
labels:
- traefik.http.routers.myapp.rule=Host(`myapp.example.com`)
- traefik.http.routers.myapp.tls.certresolver=letsencrypt
volumes:
letsencrypt:
docker compose up -d
Traefik automatically:
- Discovers the nginx container
- Routes
myapp.example.comto it - Gets SSL certificate from Let's Encrypt
- Renews certificates automatically
Zero Configuration
Add a new service? Just add Docker labels:
api:
image: my-api:latest
labels:
- traefik.http.routers.api.rule=Host(`api.example.com`)
- traefik.http.routers.api.tls.certresolver=letsencrypt
Traefik picks it up instantly. No restart needed.
Middleware
Rate Limiting
labels:
- traefik.http.middlewares.ratelimit.ratelimit.average=100
- traefik.http.middlewares.ratelimit.ratelimit.burst=50
- traefik.http.routers.api.middlewares=ratelimit
Basic Auth
labels:
- traefik.http.middlewares.auth.basicauth.users=user:$$apr1$$hash
- traefik.http.routers.dashboard.middlewares=auth
Redirect HTTP to HTTPS
labels:
- traefik.http.middlewares.redirect.redirectscheme.scheme=https
- traefik.http.routers.myapp-http.middlewares=redirect
Traefik vs Nginx
| Feature | Nginx | Traefik |
|---|---|---|
| Auto-discovery | No | Yes |
| Auto SSL | Manual/certbot | Built-in |
| Docker native | No | Yes |
| K8s native | Ingress controller | Yes |
| Config reload | Manual | Automatic |
| Dashboard | Paid (Plus) | Free |
| Learning curve | Config files | Labels |
Dashboard
Traefik includes a built-in dashboard at port 8080:
- Active routers and services
- Middleware chain visualization
- Health status
- Traffic metrics
Who Uses Traefik?
With 52K+ GitHub stars:
- Docker-based deployments
- Kubernetes clusters
- Microservice architectures
- Homelab setups
- Any environment where services change frequently
Get Started
- Add Traefik to your Docker Compose
- Add labels to your services
- Automatic HTTPS and routing
Reverse proxy that configures itself.
Need a reverse proxy for your scraping infrastructure? Check out my web scraping tools on Apify — managed scraping with built-in proxy rotation. Custom solutions: spinov001@gmail.com
Top comments (0)