【问题标题】:haproxy - URL redirect with same pathhaproxy - 具有相同路径的 URL 重定向
【发布时间】:2020-12-04 19:31:56
【问题描述】:

我需要在http://example2.com/goofy 中重定向http://example1.com/goofy,我已经使用了这一行:

redirect location http://example2.com code 301 if { hdr(host) -i example1.com }

这样,如果我继续http://example1.com/goofy,我会重定向到http://example2.com而不是http://example2.com/goofy,有人可以帮助我吗?

谢谢

【问题讨论】:

    标签: haproxy


    【解决方案1】:

    使用pathq fetch from haproxy 2.2 会很好地做到这一点:

    redirect location http://example2.com%[pathq] code 301 if { hdr(host) -i example1.com }
    

    https://cbonte.github.io/haproxy-dconv/2.2/configuration.html#7.3.6-pathq

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-02-12
      • 1970-01-01
      • 1970-01-01
      • 2012-02-24
      • 1970-01-01
      • 2016-10-07
      • 1970-01-01
      • 2018-08-25
      相关资源
      最近更新 更多