Hi "System Admin"

Am 11.03.20 um 06:22 schrieb System Admin - GRNconnect:
> The paths are like this:
> 
>     https://example.com/10001/5235723gdh.jpg
> 
>     https://example.com/10007/836789370md.jpg
> 
> We want to extract the number in the middle and compare.
> 
> I tried with
> 
>         acl image1 path_reg \/[0-9]*\/.* le 10005
>         acl image2 path_reg \/[0-9]*\/.* ge 10006
> 
>         use_backend image1 if image1
>         use_backend image2 if image2
> 
> But it is not working. How can I make this working?
> 
> I know i can probably use lua script but I rather want to achieve this using 
> ACL only if that is possible.

The field() or word() converters might be helpful for you to extract the
middle part:

http://cbonte.github.io/haproxy-dconv/2.1/configuration.html#7.3.1-field
http://cbonte.github.io/haproxy-dconv/2.1/configuration.html#7.3.1-word

Untested example:

    acl image1 path,word(1,/) -m int le 10005

Best regards
Tim Düsterhus

Reply via email to