Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4849

HAProxy capture response header Location not in Log

$
0
0

Dear HAProxy community,
I have a problem with the logging of captured response headers when a redirect is performed by HAProxy.Here is a small configuration (HAProxy version is 2.9.6-9eafce5) .

global
    log stdout format raw local0
defaults
    log global
    mode http
    log-format "%ci:%cp [%t] %ft %b/%s %sslv %sslc %TR/%Tw/%Tc/%Tr/%Td/%Ta %Th/%Ti/%Ta/%Tt %ST %B %U %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"

frontend example
    bind *:80
    mode http
    
    capture request header user-agent len 100
    capture response header Location len 15

    
    acl is_android 	req.fhdr(user-agent) -i -m reg android\s(9|\d{2})[;|)]
    acl is_ios          req.fhdr(user-agent) -i -m reg (iphone|ipod|ipad).*os\s(1[4-9]|[2-9]\d)_
    
    http-request redirect code 302 location https://kernel.org if  is_ios
    http-request redirect code 302 location https://wikipedia.org if  is_android
    http-request redirect code 302 location https://www.fsf.org if !is_android !is_ios

Actual Log Line:

10.255.0.1:40272 [18/Mar/2024:16:18:22.794] example example/<NOSRV> - - 0/-1/-1/-1/-1/0 0/0/0/0 302 100 82 - - LR-- 1/1/0/0/0 0/0 {curl/7.81.0} {} "HEAD / HTTP/1.1"

As you can see, there are empty brackets before the HEAD. How do I get the location to appear there?

Expected Log Line:

10.255.0.1:40272 [18/Mar/2024:16:18:22.794] example example/<NOSRV> - - 0/-1/-1/-1/-1/0 0/0/0/0 302 100 82 - - LR-- 1/1/0/0/0 0/0 {curl/7.81.0} {https://www.fsf.org} "HEAD / HTTP/1.1"

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 4849

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>