【发布时间】:2019-01-24 16:28:48
【问题描述】:
在 Haproxy 1.8.8 中,我试图记录最终的 URI(不是在前端收到的传入 URI),在后端部分,我有代理重写规则来更改路径。我希望新路径出现在 haproxy 日志中。这是示例 haproxy 配置文件,我想在日志中的某处记录 /defgh/v1/newpath。默认情况下,http 日志格式仅捕获请求 URI,在下面的示例中它将为 /abc/oldpath。任何人都可以建议如何在处理重写规则后捕获最终路径
示例 haproxy 配置
frontend http-in
option httplog
bind *:80
acl url_oldpath path_beg /abc/oldpath
use_backend servers if url_oldpath
backend servers
reqirep ^([^\ ]*)\ /abc/oldpath(.*) \1\ /defgh/v1/newpath\2
server server1 myServerIP:80
【问题讨论】:
标签: logging url-rewriting haproxy httpbackend