Re: Small patch for the "appsession" feature

From: Willy Tarreau <>
Date: Mon, 16 Nov 2009 08:52:49 +0100


On Sun, Nov 15, 2009 at 10:28:21PM +0100, Aleksandar Lazic wrote:
> Hi Cyril,
> On Fre 13.11.2009 22:50, Cyril Bont wrote:
> >Hello Willy,
> >sorry, I didn't have time to work on the patch as I wanted.
> >
> >Le jeudi 5 novembre 2009 06:19:41, Willy Tarreau a crit :
> >>> Sorry but I can't see in the haproxy sources how the cookie prefix can
> >>be used for appsession.
> >>> "capture cookie" allows to find this cookie prefix but it seems there's
> >>no code to then use it in appsession. If it's the case, I can work on it
> >>these next days, if you want.
> >>
> >>OK you're indeed right. So since this "feature" has never been
> >>usable nor used, let's fix it as you initially proposed.
> >
> >It works well but I have a question before considering the patch
> >finalized :)
> >As using the captured cookie may add an unwanted behaviour in some
> >existant configurations, I set it as an option.
> >First I added it as I did for "request-learn" but shouldn't it be
> >better to define these options more "haproxy like" (using "option" and
> >"no option") ?
> >
> >Which would give :
> >(no) option appsession-request-learn
> >(no) option appsession-capture-cookie
> +1

I'm not that much in favor of options for such uses, because options are inherited from default sections and will cause unexpected behaviours.

In my opinion, options should be used when they impact the general behaviour and when it is desirable to inherit them from default sections. Right now, appsessions are limited to backends only and cannot be declared in defaults sections, so I think it could become a bit awkward to have such a split configuration.

What you can do however is to create a new prefix keyword like we have for "timeout" or "tcp-request" and put the flags somewhere else. "appsession" would have been fine but it's already used. Maybe you can use "appcookie" ? Something like this :

   appcookie request-learn
   appcookie capture

Just an idea.

Willy Received on 2009/11/16 08:52

This archive was generated by hypermail 2.2.0 : 2009/11/16 09:00 CET