早些时候我没有指定自定义日志格式,并且捕获的请求标头打印得很好。我想记录unique-id-header
,但找不到任何方法。所以我复制粘贴了http://haproxy.1wt.eu/download/1.5/doc/configuration.txt 上提到的日志格式,并且唯一的 id 开始被记录。
不幸的是,现在没有记录捕获的请求标头。该%hrl and %hsl
是走出来为空字符串。
很奇怪。这是我的配置,请帮忙:(
listen server
bind *:80
mode http
option httplog
option http-server-close
no option logasap # disable early logging of HTTP requests so that total transfer time is logged
option forwardfor
capture request header X-Forwarded-For len 500
capture request header Host len 500
capture request header X-Request-UID len 500
rspadd X-Haproxy-Backend:\ server
# Generate the X-Haproxy-Unique-ID and log it to make it easy to track requests
log-format %Ci:%Cp\ …
Run Code Online (Sandbox Code Playgroud) haproxy ×1