That fixes the issue for me, thank you for the fast response!  Will this be
in 1.7.3, and is there any idea of when 1.7.3 will be released?

Thanks!
Jesse

On Fri, Jan 27, 2017 at 11:02 PM <[email protected]> wrote:

> Hi,
>
> thanks for the bug repport. I already encoutered with another function
> than redirect. Can you try the join patch ?
>
> Thierry
>
>
> On Fri, 27 Jan 2017 22:50:00 +0000
> Jesse Schulman <[email protected]> wrote:
>
> > I've found what seems to be a bug when I log from within a Lua sample
> fetch
> > that I am using to determine a redirect URL.  It seems that whatever is
> > logged from the lua script is written to the log file as expected, but it
> > also is replacing the response, making the response invalid and breaking
> > the redirection.
> >
> > Thanks,
> > Jesse
> >
> > Here's what I'm seeing:
> >
> > *no logging: curl -v http://lab.mysite.com <http://lab.mysite.com>*
> > > GET / HTTP/1.1
> > > Host: lab.mysite.com
> > > User-Agent: curl/7.51.0
> > > Accept: */*
> > >
> > < HTTP/1.1 302 Found
> > < Cache-Control: no-cache
> > < Content-length: 0
> > < Location: https://www.google.com/
> > < Connection: close
> > <
> >
> > *issue seen here with logging the string "LOG MSG" from lua script: curl
> -v
> > http://lab.mysite.com/log <http://lab.mysite.com/log>*
> > > GET /log HTTP/1.1
> > > Host: lab.mysite.com
> > > User-Agent: curl/7.51.0
> > > Accept: */*
> > >
> > LOG MSG 302 Found
> > Cache-Control: no-cache
> > Content-length: 0
> > Location: https://www.google.com/log
> > Connection: close
> >
> >
> > Here are steps to reproduce and my current setup:
> >
> > */etc/redhat-release:*
> > CentOS Linux release 7.2.1511 (Core)
> >
> > *uname -rv*
> > 3.10.0-327.28.3.el7.x86_64 #1 SMP Thu Aug 18 19:05:49 UTC 2016
> >
> > *haproxy -vv:*
> > HA-Proxy version 1.7.2 2017/01/13
> > Copyright 2000-2017 Willy Tarreau <[email protected]>
> >
> > Build options :
> >   TARGET  = linux2628
> >   CPU     = generic
> >   CC      = gcc
> >   CFLAGS  = -O2 -g -fno-strict-aliasing -Wdeclaration-after-statement
> >   OPTIONS = USE_LINUX_TPROXY=1 USE_ZLIB=1 USE_REGPARM=1 USE_OPENSSL=1
> > USE_LUA=1 USE_PCRE=1
> >
> > Default settings :
> >   maxconn = 2000, bufsize = 16384, maxrewrite = 1024, maxpollevents = 200
> >
> > Encrypted password support via crypt(3): yes
> > Built with zlib version : 1.2.7
> > Running on zlib version : 1.2.7
> > Compression algorithms supported : identity("identity"),
> > deflate("deflate"), raw-deflate("deflate"), gzip("gzip")
> > Built with OpenSSL version : OpenSSL 1.0.1e-fips 11 Feb 2013
> > Running on OpenSSL version : OpenSSL 1.0.1e-fips 11 Feb 2013
> > OpenSSL library supports TLS extensions : yes
> > OpenSSL library supports SNI : yes
> > OpenSSL library supports prefer-server-ciphers : yes
> > Built with PCRE version : 8.32 2012-11-30
> > Running on PCRE version : 8.32 2012-11-30
> > PCRE library supports JIT : no (USE_PCRE_JIT not set)
> > Built with Lua version : Lua 5.3.3
> > Built with transparent proxy support using: IP_TRANSPARENT
> IPV6_TRANSPARENT
> > IP_FREEBIND
> >
> > Available polling systems :
> >       epoll : pref=300,  test result OK
> >        poll : pref=200,  test result OK
> >      select : pref=150,  test result OK
> > Total: 3 (3 usable), will use epoll.
> >
> > Available filters :
> > [COMP] compression
> > [TRACE] trace
> > [SPOE] spoe
> >
> > *haproxy.cfg:*
> > global
> >    log 127.0.0.1 local2 debug
> >    lua-load /etc/haproxy/lua/redirect.lua
> >    chroot /var/lib/haproxy
> >    pidfile /var/run/haproxy.pid
> >    maxconn 256
> >    tune.ssl.default-dh-param 1024
> >    stats socket /var/run/haproxy.sock mode 600 level admin
> >    stats timeout 2m #Wait up to 2 minutes for input
> >    user haproxy
> >    group haproxy
> >    daemon
> >
> > defaults
> >    log global
> >    mode tcp
> >    option tcplog
> >    option dontlognull
> >    timeout connect 10s
> >    timeout client 60s
> >    timeout server 60s
> >    timeout tunnel 600s
> >
> > frontend http
> >    bind "${BIND_IP}:80"
> >    mode http
> >    option httplog
> >    option forwardfor
> >    capture request header Host len 32
> >    log-format %hr\ %r\ %ST\ %b/%s\ %ci:%cp\ %B\ %Tr
> >
> >    http-request redirect prefix "%[lua.get_redirect()]"
> >
> > *lua/redirect.lua:*
> > core.register_fetches("get_redirect", function(txn)
> >   local path = txn.sf:path()
> >   if (path == "/log") then
> >      core.Info("LOG MSG")
> >   end
> >   return "https://www.google.com";
> >
> > end)
>

Reply via email to