如何修复 Traefik 500 Internal Server Error error: unsupported protocol scheme
问题
使用 Traefik 访问特定服务时,你只看到 Internal Server Error 文本页面,即使请求从未到达你的后端。
Traefik 日志(启用调试)显示如下错误:
traefik_fix.txt
2024-11-29T04:14:23Z DBG github.com/traefik/traefik/v3/pkg/proxy/httputil/proxy.go:113 > 500 Internal Server Error error="unsupported protocol scheme \"\""解决方案
你的负载均衡器配置可能看起来像这样
myloadbalancer.toml
[http.services]
[http.services.myservice.loadBalancer]
[[http.services.myservice.loadBalancer.servers]]
port = 18215有了这个,Traefik 当然知道在哪个端口访问此服务,但它不知道使用哪个主机和哪个协议(http/https)。
要修复此问题,使用 url 而不是仅使用 port:
myconfig.toml
[http.services]
[http.services.myservice.loadBalancer]
[[http.services.myservice.loadBalancer.servers]]
url = "http://127.0.0.1:18215"调整 URL 以匹配你的服务的实际 URL。
Check out similar posts by category:
Traefik
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow