Traefik: The Cloud-Native Edge Router
Reverse proxies used to be hard. Traefik makes them magical. It discovers your services automatically.
Why Traefik?#
Traditional proxies (Nginx/HAProxy) require a static config file. Every time you add a service, you edit the file and reload.
Traefik watches your Docker Engine. When you start a container with specific labels, Traefik starts routing traffic to it instantly.
Simple Configuration#
In your docker-compose.yml:
services:
my-app:
image: my-app:latest
labels:
- "traefik.enable=true"
- "traefik.http.routers.myapp.rule=Host(`myapp.localhost`)"That’s it. Traefik sees the label and creates the route.
Automatic HTTPS (Let’s Encrypt)#
Traefik can automatically request and renew SSL certificates for your domains.
command:
- "--certificatesresolvers.myresolver.acme.email=your-email@example.com"
- "--certificatesresolvers.myresolver.acme.storage=/acme.json"
Security: Traefik handles the complexities of TLS termination, so your application containers don’t have to worry about certificates.