HAProxy 能否在向 Web 服务器传递请求时将 URI 从“domain.com/cool/url”重写为“domain.com/index.php/cool/url”?
谢谢。
reqrep <search> <string>
reqirep <search> <string> (ignore case)
Replace a regular expression with a string in an HTTP request line
May be used in sections : defaults | frontend | listen | backend
no | yes | yes | yes
Arguments :
<search> is the regular expression applied to HTTP headers and to the
request line. This is an extended regular expression. Parenthesis
grouping is supported and no preliminary backslash is required.
Any space or known delimiter must be escaped using a backslash
('\'). The pattern applies to a full line at a time. The "reqrep"
keyword strictly matches case while "reqirep" ignores case.
<string> is the complete line to be added. Any space or known delimiter
must be escaped using a backslash ('\'). References to matched
pattern groups are possible using the common \N form, with N
being a single digit between 0 and 9. Please refer to section
6 about HTTP header manipulation for more information.
Run Code Online (Sandbox Code Playgroud)
编辑:(显然)取决于您是否选择使用 HAProxy 实现重写,但是,我强烈建议您考虑使用mod_rewrite(或类似方法)。
HAProxy 的重写功能旨在促进负载平衡活动,并且从维护的角度来看,网络服务器行为不应与负载平衡器配置耦合 - 即如果要从您的托管配置中删除负载平衡器,则单个网络服务器应响应对给定 URI 的请求具有相同的内容(而不是 404 错误)。
| 归档时间: |
|
| 查看次数: |
8260 次 |
| 最近记录: |