Re: HTTP redirects while still allowing keep-alive

2017-02-28 Thread Willy Tarreau
On Fri, Jan 27, 2017 at 08:31:01PM +0200, Ciprian Dorin Craciun wrote: > No patch yet :) but I just wanted to confirm that this small change > seems to work just fine in production for the last two weeks. > (Granted I didn't make a thorough analysis of the traffic, but so far > no one complained,

Re: HTTP redirects while still allowing keep-alive

2017-01-27 Thread Ciprian Dorin Craciun
On Wed, Jan 11, 2017 at 8:59 PM, Willy Tarreau wrote: >> [I can't speak with much confidence as this is the first time I see >> the HAProxy code, but...] >> >> >> >From what I see the main culprit for the connection close is the code: >> >> [starting with line 4225 in

Re: HTTP redirects while still allowing keep-alive

2017-01-11 Thread Willy Tarreau
On Wed, Jan 11, 2017 at 08:53:18PM +0200, Ciprian Dorin Craciun wrote: > On Wed, Jan 11, 2017 at 8:27 PM, Lukas Tribus wrote: > > But if we do remove those conditions, I guess we break a number of "old > > assumptions" > > and we will hit new code paths, so there is a potential for

Re: HTTP redirects while still allowing keep-alive

2017-01-11 Thread Willy Tarreau
On Wed, Jan 11, 2017 at 07:27:08PM +0100, Lukas Tribus wrote: > Hello, > > > Am 11.01.2017 um 14:44 schrieb Willy Tarreau: > > On Wed, Jan 11, 2017 at 01:41:27PM +0200, Ciprian Dorin Craciun wrote: > > > Unfortunately a lot of these sites have hard-coded resources with the > > > `www`

Re: HTTP redirects while still allowing keep-alive

2017-01-11 Thread Ciprian Dorin Craciun
On Wed, Jan 11, 2017 at 8:27 PM, Lukas Tribus wrote: > But if we do remove those conditions, I guess we break a number of "old > assumptions" > and we will hit new code paths, so there is a potential for bugs :) [I can't speak with much confidence as this is the first time I see

Re: HTTP redirects while still allowing keep-alive

2017-01-11 Thread Lukas Tribus
Hello, Am 11.01.2017 um 14:44 schrieb Willy Tarreau: On Wed, Jan 11, 2017 at 01:41:27PM +0200, Ciprian Dorin Craciun wrote: Unfortunately a lot of these sites have hard-coded resources with the `www` alternative domain and HTTP-only. Therefore at least until we rewrite those (which given

Re: HTTP redirects while still allowing keep-alive

2017-01-11 Thread Willy Tarreau
On Wed, Jan 11, 2017 at 01:41:27PM +0200, Ciprian Dorin Craciun wrote: > Unfortunately a lot of these sites have hard-coded resources with the > `www` alternative domain and HTTP-only. Therefore at least until we > rewrite those (which given their low-value might be delayed forever), > we'll end

Re: HTTP redirects while still allowing keep-alive

2017-01-11 Thread Ciprian Dorin Craciun
On Wed, Jan 11, 2017 at 1:07 PM, Willy Tarreau wrote: > This one is obsolete, the format of the Location header field is > described here : > >https://tools.ietf.org/html/rfc7231#page-68 > > and it uses this format : > >https://tools.ietf.org/html/rfc3986#section-4.2 > > As

Re: HTTP redirects while still allowing keep-alive

2017-01-11 Thread Ciprian Dorin Craciun
On Wed, Jan 11, 2017 at 1:02 PM, Willy Tarreau wrote: > Yes that's indeed the place. The reason for this behaviour is that > (normally) when the client gets a redirect to another host or scheme, > it will no longer use the current connection and will have to close > it. The typical

Re: HTTP redirects while still allowing keep-alive

2017-01-11 Thread Willy Tarreau
On Wed, Jan 11, 2017 at 12:05:43AM +0200, Ciprian Dorin Craciun wrote: > On Tue, Jan 10, 2017 at 11:00 PM, Bryan Talbot > wrote: > > Whatever the reason for forcing the connection closed -- it only closes > > when the scheme changes. Redirecting to a different host or

Re: HTTP redirects while still allowing keep-alive

2017-01-11 Thread Willy Tarreau
Hi Ciprian, On Wed, Jan 11, 2017 at 12:58:57AM +0200, Ciprian Dorin Craciun wrote: > On Tue, Jan 10, 2017 at 9:36 AM, Cyril Bonté wrote: > > This is because haproxy behaves differently depending on the the Location > > URL : > > - beginning with /, it will allow HTTP

Re: HTTP redirects while still allowing keep-alive

2017-01-10 Thread Ciprian Dorin Craciun
On Tue, Jan 10, 2017 at 9:36 AM, Cyril Bonté 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

Re: HTTP redirects while still allowing keep-alive

2017-01-10 Thread Ciprian Dorin Craciun
On Tue, Jan 10, 2017 at 11:00 PM, Bryan Talbot wrote: > 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. >

Re: HTTP redirects while still allowing keep-alive

2017-01-10 Thread Bryan Talbot
> On Jan 10, 2017, at Jan 10, 12:28 AM, Ciprian Dorin Craciun > wrote: > > On Tue, Jan 10, 2017 at 9:36 AM, Cyril Bonté wrote: >> This is because haproxy behaves differently depending on the the Location >> URL : >> - beginning with /, it will

Re: HTTP redirects while still allowing keep-alive

2017-01-10 Thread Ciprian Dorin Craciun
On Tue, Jan 10, 2017 at 9:36 AM, Cyril Bonté 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

Re: HTTP redirects while still allowing keep-alive

2017-01-09 Thread Cyril Bonté
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 wrote: Quick question: how can I configure HAProxy to redirect (via `http-request redirect ...`) without HAProxy sending the `Connection: close`

Re: HTTP redirects while still allowing keep-alive

2017-01-09 Thread Bryan Talbot
> On Jan 8, 2017, at Jan 8, 2:03 PM, Ciprian Dorin Craciun > 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

HTTP redirects while still allowing keep-alive

2017-01-08 Thread Ciprian Dorin Craciun
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. My use-case is the following: I have a stubborn server that insists on pointing to the "wrong"