反向代理 traefik - 健康检查
反向代理 traefik - 健康检查
1. traefik.toml 配置
增加 [ping] 节点
[ping] entryPoint = "web" [entryPoints] [entryPoints.web] address = ":3147" [entryPoints.websecure] address = ":8444" [log] level = "DEBUG" filePath = "/data/winstall/traefik/traefik.log" [accessLog] filePath = "/data/winstall/traefik/access.log" [api] insecure = true dashboard = true [providers.file] filename = "/data/winstall/traefik/dynamic_conf.toml" watch = true
可访问 http://localhost:3147/ping
返回 OK
.
2. dynamic_conf.toml 配置
[http.routers.health-check] rule = "Path(`/health`)" entryPoints = ["web"] service = "ping-service" priority = 9999 middlewares = ["health-rewrite"] [http.services] [http.services.ping-service] [http.services.ping-service.loadBalancer] [[http.services.ping-service.loadBalancer.servers]] url = "http://localhost:3147/" [http.middlewares] [http.middlewares.health-rewrite.replacePath] path = "/ping"
可访问: http://localhost:3147/health \
返回 OK
end.