如何修复 Traefik Dashboard/API 404 page not found "api is not enabled"

问题:

你正在尝试以安全方式配置 Traefik API/仪表板,但每次尝试访问 API 时,你只得到 404 错误(除非你设置 api.insecure=true

在日志中,你看到类似这样的错误消息:(如果 log.level = "DEBUG"):

traefik_api_error_log.txt
traefik    | time="2020-09-20T22:53:51Z" level=error msg="api is not enabled" routerName=my-api@file entryPointName=websecure

解决方案

你必须向 Traefik 传递 --api=true,例如使用 docker-compose

docker_compose_traefik_command.yml
command:
  - "--api=true"

并设置

traefik_api_toml_snippet.toml
[api]
dashboard = true

在你的 traefik.toml 中。

之后,重启 Traefik,你应该能够在 /dashboard 访问你的仪表板。

感谢多位 GitHub 用户提供的原始解决方案。


Check out similar posts by category: Traefik