The 301 (or 302) redirects I've configured in /etc/haproxy/haproxy.cfg result in log entries which do not show 301 but 503:
127.0.0.1 - - [05/Feb/2018:12:15:09 +0200] "HEAD /latest-news HTTP/1.1" 503 1486 "" "curl/7.47.0" 103/-1 -

This makes logs analysis harder for me. Do you know whether this is a configuration issue or problem in the specific haproxy version I use?


My log related config in /etc/haproxy/haproxy.cfg is:
global
        log 127.0.0.1 local0 notice
...
frontend frontend_for_all_sites
        # log related
        capture request header Referer len 256
        capture request header User-Agent len 256
        capture request header X-Forwarded-For len 32
log-format %{+Q}o\ %{-Q}ci\ -\ -\ [%Tl]\ %r\ %ST\ %B\ %[capture.req.hdr(0)]\ %[capture.req.hdr(1)]\ %U/%Tr\ %{-Q}[capture.req.hdr(2)]
        log 127.0.0.1 local2
# redirect http-request redirect code 301 location /news if { path_reg ^/latest-news$ }


My /etc/rsyslog.d/49-haproxy.conf which writes the haproxy related logs to files:
$template RawMessage,"%msg:2:$%\n"
$RepeatedMsgReduction off

$FileOwner syslog
$FileGroup adm

$ModLoad imudp
$UDPServerAddress 127.0.0.1
$UDPServerRun 514
local0.* /var/log/haproxy/haproxy.log
local1.* /var/log/haproxy/haproxy-stats.log;RawMessage
local2.* /var/log/haproxy/site.log;RawMessage


Software versions used:
$ haproxy -v
HA-Proxy version 1.6.13-1ppa1~xenial 2017/06/19
Copyright 2000-2017 Willy Tarreau <wi...@haproxy.org>

$ cat /etc/issue
Ubuntu 16.04.2 LTS \n \l




Reply via email to