Re: ACL based on request parameter using POST method

2014-01-30 Thread Willy Tarreau
On Thu, Jan 30, 2014 at 04:30:28PM +0100, Baptiste wrote:
> Hu Dmitry,
> 
> In Post, the parameters are in the body.
> You may be able to match them using the payload ACLs (HAProxy 1.5 only).

No it will not work. Payload does not make it easy to extract just some
parts, and there's no way to wait for POST contents to arrive. This is
something we want to change in 1.6, change the analyzers order so that
we can wait for POST data at this point.

Regards,
Willy




Re: ACL based on request parameter using POST method

2014-01-30 Thread Dmitry Sivachenko

On 30 янв. 2014 г., at 19:30, Baptiste  wrote:

> Hu Dmitry,
> 
> In Post, the parameters are in the body.
> You may be able to match them using the payload ACLs (HAProxy 1.5 only).
> 


Hello,

I tried
acl PARAM1 payload(0,500) -m sub test=1
use_backend BE1-back if PARAM1


and it does not match
(I test with curl -d test=1 http://...)






Re: ACL based on request parameter using POST method

2014-01-30 Thread Baptiste
Hu Dmitry,

In Post, the parameters are in the body.
You may be able to match them using the payload ACLs (HAProxy 1.5 only).

Baptiste


On Thu, Jan 30, 2014 at 4:20 PM, Dmitry Sivachenko  wrote:
> Hello!
>
> (haproxy-1.5-dev21)
>
>
> Using urlp() I can match specific parameter value and dispatch request to 
> different backends based on that value:
>
> acl PARAM1 urlp(test) 1
> use_backend BE1-back if PARAM1
> acl PARAM2 urlp(test) 2
> use_backend BE2-back if PARAM2
>
> It works if I specify that parameter using GET method:
> curl 'http://localhost:2/do?test=1'
>
> But it does not work if I specify the same parameter using POST method:
> curl -d test=1  'http://localhost:2/do'
>
> Is there any way to make ACLs using request parameters regardless of method, 
> so that it works with both GET and POST?
>
> Thanks!



ACL based on request parameter using POST method

2014-01-30 Thread Dmitry Sivachenko
Hello!

(haproxy-1.5-dev21)


Using urlp() I can match specific parameter value and dispatch request to 
different backends based on that value:

acl PARAM1 urlp(test) 1
use_backend BE1-back if PARAM1
acl PARAM2 urlp(test) 2
use_backend BE2-back if PARAM2

It works if I specify that parameter using GET method:
curl 'http://localhost:2/do?test=1'

But it does not work if I specify the same parameter using POST method:
curl -d test=1  'http://localhost:2/do'

Is there any way to make ACLs using request parameters regardless of method, so 
that it works with both GET and POST?

Thanks!