【发布时间】:2019-10-26 18:08:38
【问题描述】:
我关注了quick start guide ,我使用了基本的traefik.toml:
traefik.toml
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.websecure]
address = ":443"
[api]
dashboard = true
insecure = true
[providers.docker]
docker-compose.yml
version: "3.7"
services:
traefik:
image: traefik
ports:
- "8080:8080"
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- "$PWD/traefik.toml:/etc/traefik/traefik.toml"
whoami:
image: containous/whoami
labels:
- "traefik.http.routers.whoami.rule=Host(`whoami.docker.localhost`)"
HTTP端点的调用:
$ curl -H Host:whoami.docker.localhost http://127.0.0.1
Hostname: aa6bfee60f2d
IP: 127.0.0.1
IP: 172.29.0.4
HTTPS 端点的调用:
curl --insecure -H Host:whoami.docker.localhost https://127.0.0.1
404 page not found
我的问题:它返回 404 page not found,而不是 HTTP 端点所做的 whoami-content。
如何在 Traefik v2 中正确启用 HTTPS?
可以在此处找到完整的(未使用的)MWE:https://github.com/boldt/traefik-v2-mwe/
【问题讨论】:
-
也许尝试添加这个标签:
traefik.http.services.whoami.loadBalancer.server.port=80?出于某种奇怪的原因为我工作。
标签: docker docker-compose yaml traefik