Debugging backend urls


#1

I’ve started haproxy using -d and I’m watching the output to figure out why I’m getting a 404 to the frontend but I’m not seeing the actual url requested to the back end. In the front end I see this:

00000000:frontend-http.clireq[000a:ffffffff]: GET /rd/eac29cced489c9000 HTTP/1.1

but in the back end it shows

00000000:backend-hitpath.srvrep[000a:adfd]: HTTP/1.1 404 Not Found

without the url.

In the backend I have this code:

http-request set-uri %[url,regsub(^/rd,/,)]

which is working fine in another server but it’s not working as expected on this server and I want to verify the url that’s being called behind the scenes.


#2

If need to do this in haproxy (as opposed to reading the log file of the backend), use the logging functionality instead of debug mode. By configuring a custom logging format you should be able to log the same value:

global
 log 127.0.0.1 syslog debug
defaults
 log global
 mode http
 option httplog
    log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC \
                %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r rewrite:%[url,regsub(^/rd,/,)]"