Created
April 25, 2022 06:45
-
-
Save PlugFox/16791b9686e4c949623a0adfc52f31de to your computer and use it in GitHub Desktop.
Traefik reverse proxy to external site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http: | |
middlewares: | |
api-flutter-header: | |
headers: | |
customRequestHeaders: | |
Host: "master-api.flutter.dev" | |
routers: | |
api-flutter-router: | |
service: api-flutter-service | |
rule: "Host(`api.flutter.domain.tld`)" | |
tls: | |
certResolver: le | |
middlewares: | |
- "api-flutter-header" | |
services: | |
api-flutter-service: | |
loadBalancer: | |
servers: | |
- url: "https://master-api.flutter.dev" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.3" | |
services: | |
# Traefik is the reverse proxy | |
traefik: | |
container_name: traefik | |
image: "traefik:v2.7.0-rc2" | |
restart: unless-stopped | |
ports: | |
- 80:80 | |
- 443:443 | |
volumes: | |
- /etc/localtime:/etc/localtime:ro | |
# Add Docker as a mounted volume, so that Traefik can read the labels of other services | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
# Logs in root directory | |
- /root/traefik/log:/log | |
# Mount the volume to store the certificates | |
- /root/traefik/certificates:/certificates | |
# Load balancer to api.flutter.dev | |
- /root/traefik/api_flutter.yaml:/api_flutter.yaml:ro | |
command: | |
# Create an entrypoint "http" listening on port 80 | |
- --entrypoints.http.address=:80 | |
# Create an entrypoint "https" listening on port 443 | |
- --entrypoints.https.address=:443 | |
# Logs | |
- --accesslog | |
- --log | |
- --log.level=WARN | |
- --log.format=json | |
- --log.filePath=/log/log.json | |
- --certificatesresolvers.le.acme.httpchallenge=true | |
- --certificatesresolvers.le.acme.email=email@domain.tld | |
- --certificatesresolvers.le.acme.storage=/certificates/acme.json | |
- --certificatesresolvers.le.acme.httpchallenge.entrypoint=http | |
# Redirect to api.flutter.dev | |
- --providers.file.filename=/api_flutter.yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment