Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4741

ACL rule which works only if ALL header values are in the whitelist

$
0
0

Hi people!

I need to create an ACL rule which will work only if ALL values from a header are in the whitelist.

I’ve created a small whitelist:

foo
bar

And this is my haproxy.cfg:

defaults
    mode http

frontend http_frontend
    bind *:80
    acl valid-hdr req.hdr(x-my-header) -m str -f /usr/local/etc/haproxy/whitelist.lst
    use_backend mysite if valid-hdr

backend mysite
    server mysite 172.10.1.1:80 check

What I want:

  • X-My-Header: foo - valid
  • X-My-Header: bar - valid
  • X-My-Header: foo,bar - valid
  • X-My-Header: bar,foo - valid
  • X-My-Header: bar,something,foo - NOT valid

What I get:
Actually all requests are considered to be valid if AT LEAST one of ‘foo’, ‘bar’ present in the header value.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 4741

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>