Dev Proxy with Traefik
This project sets up a local development environment with Traefik as a reverse proxy.
What is Traefik?
Traefik is a modern reverse proxy and load balancer that automatically discovers your services and configures itself accordingly. This makes it perfect for containerized environments.
Getting Started
- Ensure Docker and Docker Compose are installed on your system
- Start the services:
docker-compose up -d - Access the Traefik dashboard at: http://traefik.localhost:8080
- Access the example app at: http://app.localhost
Configuration
The main configuration is in the docker-compose.yml file and additional Traefik configuration is in the traefik/config/ directory.
To add a new service to be proxied by Traefik:
- Add a new service to the docker-compose.yml
- Add the appropriate Traefik labels to the service
- Restart the containers with
docker-compose up -d
Example Labels
labels:
- "traefik.enable=true"
- "traefik.http.routers.myservice.rule=Host(`myservice.localhost`)"
- "traefik.http.routers.myservice.entrypoints=web"
- "traefik.http.services.myservice.loadbalancer.server.port=8080"
Description