haproxy acl path and method

  • I'm trying to create a rule like this :

    path_beg /api/user/ && method GET

    I need specifically validate a URL and method it uses

    but it doesn't works, some ideas?

  • @Xivexell
    I would try something like this:

    acl check1 path_beg /api/user/
    acl check2 method GET
    http-request deny 404 if check1 check2

  • Thanks for your answer, I try it, works when I have one path, but If I have other rules, it doesn't works c992ce7a-1e0a-400c-bb3d-d8af8957eda1-imagen.png

  • @Xivexell
    I notice that you have the "NOT" checkbox set.. So i wonder what you expect to happen.?

    If the user is 'NOT requesting /api/user' AND the user is 'NOT using method GET/POST/DELETE' then do something.?

    Or would you perhaps prefer to have and 'OR' = || between those 2 acls.?

    Result in haproxy.cfg (see the ! signs and the | ..):

    	acl			Rule1	var(txn.txnpath) -m beg -i /api/user/
    	acl			Rule2	method GET POST DELETE
    	http-request deny deny_status 402  if  !Rule1 || !Rule2 

Log in to reply