On Tue, Jan 10, 2017 at 9:36 AM, Cyril Bonté <[email protected]> wrote: > This is because haproxy behaves differently depending on the the Location > URL : > - beginning with /, it will allow HTTP keep-alived connections (Location: > /redir/foo) > - otherwise it unconditionnally won't, and there's no option to change this > (Location: http://mysite/redir)
First of all, sorry for providing an incomplete email by not specifying the HAProxy version (which is 1.6.10), and a configuration example. Also thanks Cyril for pointing out to this behaviour, as in fact this is exactly my use-case, redirecting a `www` site to its prefix-less name. (And perhaps towards `HTTPS`, but this could be solved by specifying the `Content-Security-Policy: ugrade-insecure-requests`.) (Also my redirects are 307, i.e. temporary and instructing the browser to use the same HTTP method.) Might I ask why this behaviour? I assume that it was presumed that these redirects will happen only once for a particular client, and keeping alive that connection would be useless, as the client would initiate a different one, given that the host in the URL changed. Perhaps can someone point me to the piece of code responsible for this behaviour? (I could write a patch and apply it only to my particular deployment.) However, might the following trick solve the problem: * I create a frontend dedicated to make the redirects; * I create a backend which uses as server the previously defined frontend, and specifies the `http-server-close` behaviour; * in the "main" frontend (where the redirects used to be) I just forward (via `use-server`) the requests needed to be redirected to the newly introduced backend; Would this solve the connection closing on redirects? (I'll have to test this sometime these days, and report back.) Thanks, Ciprian.

