It appears that all usages of unset-var don't support conditions.
Meaning none of the following work:
http-request unset-var(txn.foo) if { always_true }
tcp-request content unset-var(txn.foo) if { always_true }
etc.
The error presented is:
[ALERT] 153/175307 (58641) : parsing [haproxy-minimal.cfg:12] : error
detected in frontend 'f1' while parsing 'http-request
unset-var(txn.foo)' rule :
fetch method not supported.
[ALERT] 153/175307 (58641) : Error(s) found in configuration file :
haproxy-minimal.cfg
The documentation indicates this should be possible:
http-request unset-var(<var-name>) [ { if | unless } <condition> ]
This is experienced with version 1.9.8
-Patrick