【问题标题】:Traefik 2.0 redirectTraefik 2.0 重定向
【发布时间】:2019-12-20 14:36:35
【问题描述】:

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

defaultEntryPoints = ["http"]

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

没有任何码头工人。

谢谢, 洛朗。

【问题讨论】:

    标签: traefik


    【解决方案1】:

    成功了:

    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"
    

    必须使用完整的 url 调用,例如:http://localhost/index.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-30
      • 2021-04-08
      • 1970-01-01
      • 1970-01-01
      • 2020-02-09
      • 2021-07-20
      • 2021-05-29
      • 1970-01-01
      相关资源
      最近更新 更多