I have an haproxy (1.6) instance that 301 redirects certain GET
requests. Unfortunately, the paths of those requests are being truncated
at 1024 bytes.

After much reading and experimenting, I strongly suspect the issue is
the length of what is captured by |capture.req.uri|, which is 1024. But
I've not succeeded in increasing that number. I'm quite open to pointers.

Here are the most relevant snippets from my |haproxy.cfg|:

    |global tune.bufsize 131072 tune.maxrewrite 65536 defaults frontend
    www-https bind ssl crt /etc/haproxy/ssl/ declare capture
    request len 16382 declare capture response len 16382 http-request
    capture capture.req.uri len 16382 acl redirect_canonical ssl_fc_sni
    -i myname.example.com http-request redirect code 301 location
    https://www.example.com%[capture.req.uri] if redirect_canonical |

There's clearly some cruft in there, as I've been experimenting trying
to make it go.  And I've dropped all that's clearly not relevant, like
the backends etc.

My test is to do this (which may be slightly off, because, of course, my
domain is not example.com, but the point is that the Location: should
end with 1234567890 and it doesn't.  The printf just generates
TESTTESTTEST... 256 times in a row.

    $ curl -I --silent https://myname.example.com/$(printf 'TEST%.0s'
    {1..256}; echo 1234567890) | sed -e 's/TEST//g;'
    HTTP/1.1 301 Moved Permanently
    Content-length: 0
    Location: https://www.example.com/T
    Connection: close


I've poked around in the code a bit, and I see that the default for
captures is 1024 (defaults.h:58), but it seems that it can be
overridden, just not how I'm trying to do it.

Any pointers?


Jeff Abrahamson

Reply via email to