Overview
Traefik automatically discovers services via Docker labels and configures routing rules, provides TLS termination, and adds middleware for CORS and path manipulation.Configuration
Docker Compose
Ports
| Port | Purpose |
|---|---|
| 80 | HTTP entrypoint |
| 8080 | Dashboard and API |
Features
Automatic service discovery
Traefik discovers services via Docker labels:Dynamic routing
Routes update automatically when:- Containers start or stop
- Labels are added or changed
- Services scale up or down
Middleware support
Traefik applies middleware for:- Path stripping
- CORS headers
- Authentication
- Rate limiting
- Compression
Routing configuration
All services are routed through Traefik:App (frontend)
http://localhost/
Joystick API
http://localhost/joystick/
Panel UI
http://localhost/panel/
Baker API
http://localhost/baker/
Switcher API
http://localhost/switcher/
Whisper API
http://localhost/whisper/
Studio API
http://localhost/studio/
Middleware
CORS middleware
Shared CORS configuration:StripPrefix middleware
Removes path prefix before forwarding:- Request:
http://localhost/joystick/api/health - Forwarded:
http://joystick:8000/api/health
Dashboard
Traefik dashboard available at:Dashboard features
- Routers - View all configured routes
- Services - See backend services and health
- Middleware - Inspect middleware configuration
- Providers - View Docker provider status
Docker provider
Traefik uses Docker provider for service discovery:Configuration
exposedbydefault=false- Only expose labeled services- Watches Docker socket for container changes
- Updates routing in real-time
Entrypoints
HTTP entrypoint
Future: HTTPS entrypoint
For production, add HTTPS:Host configuration
TheHOST environment variable controls the hostname:
Load balancing
Traefik can load balance across multiple service instances:Health checks
Traefik monitors service health:Logging
Configure log level:Security
IP allowlist
Restrict access by IP:Basic authentication
Add basic auth:Rate limiting
Limit request rate:Troubleshooting
Service not accessible
- Check
traefik.enable=truelabel exists - Verify routing rule matches request
- Review Traefik dashboard for router status
- Check service is running and healthy
CORS errors
- Verify CORS middleware is applied
- Check middleware configuration
- Test with curl to see headers
Path issues
- Verify StripPrefix middleware
- Check service expects correct path
- Test direct service access
Dashboard not accessible
- Verify
--api.insecure=trueis set - Check port 8080 is exposed
- Ensure not blocked by firewall
Best practices
Use path prefixes
Organize services with clear paths:Enable CORS middleware
Always add CORS for API services:Monitor dashboard
Regularly check dashboard for:- Service health status
- Routing configuration
- Error rates
Secure in production
For production deployments:- Disable insecure API
- Enable HTTPS
- Add authentication
- Implement rate limiting
- Use IP allowlists