5

I want to create an ACL in haproxy 1.6 that allows a particular url and url parameter ONLY when they both appear at the same time. For example:

example.com/url/of/page3?foo=bar

I am doing this already in the frontend section of my haproxy config:

acl whitelist path /url/of/page1
acl whitelist path /url/of/page2
acl whitelist path_beg /url/of/page3
block unless whitelist

How do I use url_param in combination with with path in my acl?

1 Answer 1

5
  • Not sure which version you're running, but, just as a note: AFAIK, the block directive is deprecated. Using this, gives you:

The 'block' directive is now deprecated in favor of 'http-request deny' which uses the exact same syntax. The rules are translated but support might disappear in a future version.

  • It still works, but it might get removed in the future.

  • Regarding your question:

    • Just set up another ACL:

      acl url_param urlp(foo) bar
      

      This tests the first, and only the first url param against the name foo and the value bar, and evaluates to TRUE or FALSE.

    • So, after this, check for the results via:

      http-request deny unless whitelist url_param
      
1
  • Hello, how would you do this if you want to redirect example.com/?foo=bar to example.com/my/app/?foo=bar?
    – Lester
    Jun 10, 2020 at 10:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .