目前,我通过V2访问http://traefik.my.server:8080/dashboard/
仪表板(Traefik运行在一个码头容器中,8080暴露在主机上)。我想修改一下,以便仪表板可以在http://traefik.my.server/dashboard
上使用。
我试图添加以下标签来配置此行为,但在访问404
时得到了一个http://traefik.my.server/dashboard
- traefik.http.routers.dashboard.rule=Host(`traefik.my.server:`) && Path(`/dashboard`)
- traefik.http.services.dashboard.loadbalancer.server.port=8080
- traefik.http.routers.dashboard.entryPoints=http
( http
入口点是端口80
)
设置这种重定向的正确方法是什么?
发布于 2020-01-24 13:37:14
发布于 2020-01-24 14:13:40
在https://community.containo.us/t/how-to-redirect-to-the-dashboard-from-a-url/4082上跟踪@Idez帮助之后,一个工作配置是
docker-compose
文件:
services:
traefik:
container_name: traefik
image: traefik
ports:
- 80:80
- 443:443
restart: unless-stopped
volumes:
- /etc/docker/container-data/traefik:/etc/traefik
- /var/run/docker.sock:/var/run/docker.sock
- /etc/localtime:/etc/localtime:ro
labels:
- traefik.http.routers.api.rule=Host(`traefik.mydomain.org`)
- traefik.http.routers.api.service=api@internal
- traefik.http.routers.api.middlewares=lan
- traefik.http.middlewares.lan.ipwhitelist.sourcerange=192.168.10.0/24, 192.168.20.0/24
- traefik.enable=true
version: "3"
配置文件
global:
sendAnonymousUsage: true
entryPoints:
http:
address: ":80"
https:
address: ":443"
api:
dashboard: true
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
defaultRule: "Host(`{{ index .Labels \"com.docker.compose.service\" }}.mydomain.org`)"
log:
level: INFO
#level: DEBUG
certificatesResolvers:
le:
acme:
email: le@mydomain.org
storage: /etc/traefik/acme.json
tlsChallenge: {}
#caServer: "https://acme-staging-v02.api.letsencrypt.org/directory"
https://stackoverflow.com/questions/59896794
复制相似问题