I've got a Traefix set up and I'm trying to expose a dashboard to a website served through Cloudflare with SSL. I've combed through the docs and I can't for the life of me figure out how to expose the docs to a subdomain of one of my sites. I've got the following docker-compose file:
services:
traefik:
container_name: traefik
image: "traefik"
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboard.rule=Host(`foo.bar.dev`) && PathPrefix(`/`)"
- "traefik.http.routers.dashboard.entrypoints=websecure"
- "traefik.http.routers.dashboard.service=dashboard@internal"
- "traefik.http.routers.dashboard.middlewares=dashboard_redirect@internal,dashboard_stripprefix@internal"
- "traefik.http.routers.dashboard.priority=2"
- "traefik.http.routers.api.rule=Host(`foo.bar.dev`) && PathPrefix(`/api`)"
- "traefik.http.routers.api.entrypoints=websecure"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.priority=1"
- "traefik.http.routers.api.middlewares=dashboard_redirect@internal,dashboard_stripprefix@internal"
ports:
- "443:443"
- "8080:8080"
expose:
- 443
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./traefik.toml:/traefik.toml"
version: "3.3"
and the following traefik.toml file:
[accessLog]
[api]
dashboard = true
insecure = true
[providers.docker]
exposedByDefault = false
[entryPoints]
[entryPoints.websecure]
address = ":443"
I still get a 404 on the subdomain. The certificates are arranged by cloudflare so I land on port 443 in my network without any problems. My port is then forwarded by my routers to my Traefix server. I feel like the host rule is not being triggered because when I access port 8080 directly from the IP in the internal network I can access the dashboard and see the two rules set in docker.
Anybody who can point me in the right direction?
I eventually got it work with the following configuration:
version: "3.3"
services:
traefik:
container_name: traefik
image: "traefik"
networks:
- webgateway
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboard.rule=Host(`foo.bar.dev`)"
- "traefik.http.routers.dashboard.entrypoints=websecure"
- "traefik.http.routers.dashboard.tls"
- "traefik.http.services.dashboard.loadbalancer.server.port=8080"
ports:
- "443:443"
expose:
- 8080
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./traefik.toml:/traefik.toml"
networks:
webgateway:
driver: bridge
[log]
level = "DEBUG"
[accessLog]
[api]
dashboard = true
insecure = true
[providers.docker]
exposedByDefault = false
[entryPoints]
[entryPoints.websecure]
address = ":443"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.