haproxy - 将特定 domain/path 重定向到其他域
haproxy - redirect specific domain/path to other domain
我需要将来自特定 domain/path 的请求重定向到具有相同路径的其他域,例如
域。com/foo/everything --> 示例。com/foo/everything
我认为需要使用 url_reg
但我不明白如何处理重定向,也许是这样的事情?
acl redirect-foo url_reg -i ^domain.com\/foo\/*
http-request redirect code 301 location http://example.com/foo/ if redirect-foo
但是显然不行,谢谢哪位能帮帮我
您可以使用以下代码片段
acl host_match hdr(host) -i domain.com
acl path_match path_beg -i /foo/
http-request redirect code 301 location http://example.com/%[capture.req.uri] if host_match path_match
文档和以下博客中描述了 acl post。
的文档
我需要将来自特定 domain/path 的请求重定向到具有相同路径的其他域,例如
域。com/foo/everything --> 示例。com/foo/everything
我认为需要使用 url_reg
但我不明白如何处理重定向,也许是这样的事情?
acl redirect-foo url_reg -i ^domain.com\/foo\/*
http-request redirect code 301 location http://example.com/foo/ if redirect-foo
但是显然不行,谢谢哪位能帮帮我
您可以使用以下代码片段
acl host_match hdr(host) -i domain.com
acl path_match path_beg -i /foo/
http-request redirect code 301 location http://example.com/%[capture.req.uri] if host_match path_match
文档和以下博客中描述了 acl post。
的文档