Hi all,

Le 10/01/2017 à 01:28, Bryan Talbot a écrit :

On Jan 8, 2017, at Jan 8, 2:03 PM, Ciprian Dorin Craciun 
<[email protected]> wrote:

Quick question:  how can I configure HAProxy to redirect (via
`http-request redirect ...`) without HAProxy sending the `Connection:
close` header, thus still allowing keep-alive on this connection.

I do not see the behavior you describe, but I also do no know what haproxy 
version you might be using or what your config might be like.

haproxy version 1.7.1 with a proxy config like that shown below does not close 
the connection and contains no “connection: close” header for me.

listen http
    bind :8000
    http-request redirect prefix /redir



$> curl -v http://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: /redir/foo
<
* Curl_http_done: called premature == 0
* Connection #0 to host 127.0.0.1 left intact

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)


My use-case is the following:  I have a stubborn server that insists
on pointing to the "wrong" resource URL's, thus on a page load, I get
a storm of redirects, each with a different connection (due to the
`Connection: close` reply header).


I tried to skim the documentation and search the internet (and the
mailing list archives), but no such topic popped-up, thus I have the
feeling this is quite impossible as of now...

Thanks,
Ciprian.





--
Cyril Bonté

Reply via email to