Traefik API端点抛出404页面,没有找到基本配置



我成功地使用traefikLAN上本地托管web服务。我想看看由traefik以安全的方式提供的仪表板(不使用insecure=true配置)。

根据官方文档,配置应该如下所示:

# Dynamic Configuration
[http.routers.my-api]
rule = "Host(`traefik.example.com`)"
service = "api@internal"
middlewares = ["auth"]
[http.middlewares.auth.basicAuth]
users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"]
[api]
dashboard = true

但是当我用curlcurl 'http://traefik.example.com'运行traefik时,我得到404 page not found和日志显示:

21/Jun/2022:14:40:46 +0000] "GET / HTTP/1.1" 404 19 "-" "-" 1 "-" "-" 0ms

实际的服务还在工作,所以一定是配置有问题。

根据文档

[api]
dashboard = true

需要成为静态配置的一部分。您将它添加到动态配置