【发布时间】:2017-12-18 12:28:09
【问题描述】:
场景:如果 url 是 http://domain 或 http://domain/web 则不应该有重定向。对于其他任何事情,比如http://domain/abc 或http://domain/xyz,应该重定向到http://domain2。
这是我尝试过的,但它只适用于http://domain/web。如果 url 是http://domain,它仍然会重定向到http://domain2。
acl is_root path -i
acl missing_slash path_reg ^/*/[^/]*$$
acl isweb path_beg /web
http-request set-header X-Location-Path %[capture.req.uri] if !isweb !is_root !missing_slash
http-request replace-header X-Location-Path [^/]+/(.*) \1 if !isweb !is_root !missing_slash
http-request redirect code 301 location https://www.domain2.com%[hdr(X-Location-Path)] if !isweb !is_root !missing_slash
【问题讨论】: