> On Jan 10, 2017, at Jan 10, 12:28 AM, Ciprian Dorin Craciun > <ciprian.crac...@gmail.com> wrote: > > On Tue, Jan 10, 2017 at 9:36 AM, Cyril Bonté <cyril.bo...@free.fr> 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) > >
Whatever the reason for forcing the connection closed -- it only closes when the scheme changes. Redirecting to a different host or port when using a “scheme less” URI allows the connection to be kept open. listen http bind :8000 http-request redirect location //127.0.0.2:8001/redir $> curl -L -v 127.0.0.1:8000/foo * Trying 127.0.0.1... * TCP_NODELAY set * Connected to 127.0.0.1 (127.0.0.1) port 8000 (#0) > GET /foo HTTP/1.1 > Host: 127.0.0.1:8000 > User-Agent: curl/7.52.1 > Accept: */* > < HTTP/1.1 302 Found < Cache-Control: no-cache < Content-length: 0 < Location: //127.0.0.2:8001/redir < * Curl_http_done: called premature == 0 * Connection #0 to host 127.0.0.1 left intact * Issue another request to this URL: 'http://127.0.0.2:8001/redir' * Trying 127.0.0.2… Maybe that will be useful to Ciprian to make the redirect to a new hostname but keep the connection to the old host open if that’s what is needed. -Bryan