Routing External service // Adding Host Server

Hello,

I am trying to proxy an external service via Traefik. I somehow can't get it to correctly set the host header so that the target service matches it to the right hostname.

Below an example with Google that demonstrates it (returns 404 because the host header isn't set to google.com). When turning on debugging the Host stays localhost/null.

What am I missing?

[http]
  [http.routers]
     [http.routers.google]
      rule = "PathPrefix(`/`)"
      middleware = ["hostHeader"]
      service = "google"

[http.middlewares]
  [http.middlewares.hostHeader.headers]
    [http.middlewares.hostHeader.headers.customRequestHeaders]
      Host = "google.com"

  [http.services]
    [http.services.google.loadBalancer]
      [[http.services.google.loadBalancer.servers]]
        url = "https://google.com"

Thanks,
Elmar

Your configuration is more or less correct and it's working - I tested it and used your file as is.
More or less, because you do not need to mess around with the header and the middelware, you can safely comment that out.

I'm not sure if that's the reason. There is probably something else that you configured or are using incorrectly.

I have exactly the same problem:

Do you have already a solution?

Thanks in advance

I have the same issue, did you figure it out?