How to fix Traefik 500 Internal Server Error error: unsupported protocol scheme

Problem

When you access a specific service with Traefik, you just see a Internal Server Error text page even though the request never reaches your backend.

The Traefik logs (with debug enabled) show an error like this:

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 \"\""

Solution

Your load balancer config for this service probably looks something like

[http.services]
  [http.services.myservice.loadBalancer]
    [[http.services.myservice.loadBalancer.servers]]
      port = 18215

With this Traefik, surely knows which port to access this service at, but it doesn’t know which host and which protocol (http/https) to use.

To fix this, use url instead of just port:

[http.services]
  [http.services.myservice.loadBalancer]
    [[http.services.myservice.loadBalancer.servers]]
      url = "http://127.0.0.1:18215"

Adjust the URL to match your service’s actual URL.