Editing haproxy.cfg
-
Some rules I'm trying to set don't seem to stick (the ACLs won't match). To workaround it, I tried using negative matches, e.g;
but it didn't work either.
I tried adding my own rule in the advanced section but I discovered these are added before the ACLs thus I can't refer to the existing ACLs from there since rules are evaluated in order.
Last option was editing
haproxy.cfg
directly so I could use theunless
statement. I did just that then I snooped around the CLI to find how to restart HAProxy from there (so then maybe the data from the GUI was ignored), I found two entries:/usr/local/etc/rc.d/haproxy
/usr/local/etc/rc.d/haproxy.sh
The first didn't work. The second did but it overwrote the changes to
haproxy.cfg
to what's on the GUI. The first one though, mentioned something about enabling it. I think the one that works is an augmented version of the first that first parses things on the GUI.Is that anywhere close to true? How can/could I edit
haproxy.cfg
manually so it's not overwritten when it's restarted?I didn't investigate further because I'm only familiar with
systemd
+ for 2.6, I just reinstalled with custom external ZFS mounts for logs and caching and whatnot and it's running flawlessly--I don't want to screw that up. -
I made it work with regex matching, though, I'd still like to edit the file--the HAProxy docs mention regex matching hits on performance. :/
I don't know how regex works but I hope a super simple catch all host regex "
(.*)
" rule plus creative rule re-ordering are easier on the cores.