Traefik 2.0重定向

时间:2019-12-20 14:36:35

标签: traefik

我想创建一个traefik v2配置文件,该文件将http://localhost:80流量重定向到http://otherhost.example.com:8080

defaultEntryPoints = ["http"]

[entryPoints]
   [entryPoints.dashboard]
   address = ":80"
   [entryPoints.dashboard.redirect???]
     scheme = "http"       
     port = "8080"

没有码头工人。

谢谢, 洛朗。

1 个答案:

答案 0 :(得分:0)

那行得通:

defaultEntryPoints = ["http"]

## Static configuration
[entryPoints]
  [entryPoints.web]
    address = ":80"

[providers]
  [providers.file]
    filename = "dynamic_conf.toml"
    watch = true

还有dynamic_conf.toml

## Dynamic configuration

[http.routers]
  [http.routers.Router-1]
    # By default, routers listen to every entry points
    rule = "Host(`localhost`)"
    service = "my-service"

[http.services]
  [http.services.my-service.loadBalancer]
    passHostHeader = false
    [[http.services.my-service.loadBalancer.servers]]
      url = "http://example.com"

必须使用完整的网址来调用它,例如:http://localhost/index.html