haproxy将URL的查询重定向到另一个URL [英] haproxy redirect aquery of URL to another URL
本文介绍了haproxy将URL的查询重定向到另一个URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要重定向
https://example1.com/?id=NUMBER
https://example2.com/ords/test/portal/test_ppp_& lang = zh-CN&?id = NUMBER
我需要"Id = NUMBER"(其中NUMBER是动态的)作为ID进行重定向.
I need "Id=NUMBER" (which NUMBER is dynamic) to be in redirection as id.
推荐答案
如果您的HAProxy版本是2.0,则应使用 http-request replace-uri .有关 HAProxy文档:replace-uri
If your HAProxy version is 2.0 you should use http-request replace-uri. More information on HAProxy documentation: replace-uri
有关其工作方式的示例:
An example on how it works:
# prefix /foo : turn /bar?q=1 into /foo/bar?q=1
http-request replace-uri ([^/:]*://[^/]*)?(.*) \1/foo\2
如果您使用的是较旧的HAProxy版本,则可以尝试regrep 或 regsub .
If you are using an older HAProxy version you can try regrep or regsub.
这篇关于haproxy将URL的查询重定向到另一个URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文