Hi Baptiste,

Thanks for the confirmation.
Since I want to rate limit based on a "SessionId", is this something
that I should implement?

Thanks,
Harshad

On 4 February 2012 11:25, Baptiste <[email protected]> wrote:
> Hi Harshad,
>
> For now, this could work only in HAProxy 1.5, but not in current dev7 version.
> Up to haproxy 1.5-dev7, you can only apply this kind of tracking on
> IPs based tables, not on string tables.
>
> Willy, EmerivBR told me you would release soon tracking based on string 
> tables.
> Can you confirm ..... or not :)  ??
>
> cheers
>
>
> On Fri, Feb 3, 2012 at 4:15 PM, Harshad R <[email protected]> wrote:
>> Hi,
>>
>> Is it possible to maintain gpc0/connection rate based on an arbitrary
>> pattern fetch?
>>
>> My stick table is based on a header X-Session which is a string
>> pattern. I would like to rate limit based on UID it contains.
>>
>> Backend config:
>> backend app
>>    balance     roundrobin
>>    server  app1 127.0.0.1:80 check cookie app1
>>    stick-table type string size 200k store gpc0
>>    stick on uid
>>
>> We have implemented uid as a custom pattern fetch in code with
>>
>>
>> static int
>> pattern_fetch_uid(struct proxy *px, struct session *l4, void *l7, int dir,
>>                     const struct pattern_arg *arg_p, int arg_i, union
>> pattern_data *data)
>> {
>>        struct hdr_ctx ctx;
>>        struct http_txn *txn = l7;
>>        struct http_msg *msg = &txn->req;
>>        const char *hdr;
>>        int hdr_len;
>>        uauth_t uauth;
>>
>>        ctx.idx = 0;
>>        if(http_find_header2("X-Session", sizeof("X-Session")-1,
>> msg->sol, &txn->hdr_idx, &ctx)) {
>>  ....
>>       return 1;
>>       }
>> }
>>
>>
>> static struct pattern_fetch_kw_list pattern_fetch_keywords = {{ },{
>>        { "uid", pattern_fetch_uid, NULL, PATTERN_TYPE_STRING,
>> PATTERN_FETCH_REQ },
>>        { NULL, NULL, NULL, 0, 0 },
>> }};
>>
>>
>> From the stats output, it is observed that gpc0 is not getting incremented.
>>> show table app
>> # table: app, type: string, size:204800, used:8
>> 0xa510398: key=001 use=0 exp=0 server_id=1 gpc0=0
>> 0xa518f18: key=11859 use=0 exp=0 server_id=1 gpc0=0
>> 0xa519188: key=12375 use=0 exp=0 server_id=1 gpc0=0
>> 0xa518d78: key=12603 use=0 exp=0 server_id=1 gpc0=0
>> 0xa5190b8: key=17522 use=0 exp=0 server_id=1 gpc0=0
>> 0xa518fe8: key=31653 use=0 exp=0 server_id=1 gpc0=0
>> 0xa510468: key=31943 use=0 exp=0 server_id=1 gpc0=0
>> 0xa518e48: key=3325 use=0 exp=0 server_id=1 gpc0=0
>>
>> Is there a generic configuration operation to increment/get gpc0. e.g.
>>
>> stick increment gpc0
>> acl abuse  stick_get_gpc0 gt 10
>>
>> Also, we would like to use frequency counter for this. e.g.
>> acl abuse stick_get_gpfc0 gt 10
>>
>> Thanks,
>> Harshad
>>

Reply via email to