问题原文
原帖链接 · simon · CC BY-SA 3.0
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?
已采纳解答
原帖链接 · gxx · CC BY-SA 3.0
- Not sure which version you're running, but, just as a note: AFAIK, the
blockdirective 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) barThis tests the first, and only the first url param against the name
fooand the valuebar, and evaluates toTRUEorFALSE.So, after this, check for the results via:
http-request deny unless whitelist url_param
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
