Ok, I understand what you mean now, however I’m unable to reproduce this issue.
I setup a php script which basically sets both cookies:
<?php
setcookie('_WL_AUTHCOOKIE_WCC-ADF-JSESSIONID', "wrong long cookie");
setcookie('WCC-ADF-JSESSIONID', "realshortcookie");
?>
Running this through haproxy with the following config in the backend (and a stats socket /tmp/haproxy.stats level admin in the global section):
stick-table type string len 32 size 204800
stick store-response res.cook(WCC-ADF-JSESSIONID)
stick match req.cook(WCC-ADF-JSESSIONID)
And when I run the request through it:
0000004a:port80.accept(0007)=000b from [10.0.0.4:61009] ALPN=<none>
0000004a:port80.clireq[000b:ffffffff]: GET /dualcookie.php HTTP/1.1
0000004a:port80.clihdr[000b:ffffffff]: Host: dev.lan.ltri.eu
0000004a:port80.clihdr[000b:ffffffff]: User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0
0000004a:port80.clihdr[000b:ffffffff]: Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
0000004a:port80.clihdr[000b:ffffffff]: Accept-Language: de,en;q=0.8,it;q=0.5,en-US;q=0.3
0000004a:port80.clihdr[000b:ffffffff]: Accept-Encoding: gzip, deflate
0000004a:port80.clihdr[000b:ffffffff]: DNT: 1
0000004a:port80.clihdr[000b:ffffffff]: Connection: keep-alive
0000004a:port80.clihdr[000b:ffffffff]: Upgrade-Insecure-Requests: 1
0000004a:port80.clihdr[000b:ffffffff]: Cache-Control: max-age=0
0000004a:my-backend.srvrep[000b:000c]: HTTP/1.1 200 OK
0000004a:my-backend.srvhdr[000b:000c]: Server: nginx/1.10.3 (Ubuntu)
0000004a:my-backend.srvhdr[000b:000c]: Date: Sat, 08 Sep 2018 12:05:23 GMT
0000004a:my-backend.srvhdr[000b:000c]: Content-Type: text/plain; charset=utf-8
0000004a:my-backend.srvhdr[000b:000c]: Transfer-Encoding: chunked
0000004a:my-backend.srvhdr[000b:000c]: Connection: keep-alive
0000004a:my-backend.srvhdr[000b:000c]: Set-Cookie: _WL_AUTHCOOKIE_WCC-ADF-JSESSIONID=wrong+long+cookie
0000004a:my-backend.srvhdr[000b:000c]: Set-Cookie: WCC-ADF-JSESSIONID=realshortcookie
The table contains only the exact cookie match:
lukas@dev:~$ echo "show table my-backend" | sudo socat unix-connect:/tmp/haproxy.stats stdio
# table: my-backend, type: string, size:204800, used:1
0x2006204: key=realshortcookie use=0 exp=0 server_id=1
lukas@dev:~$
It does not contain the _WL_AUTHCOOKIE_WCC-ADF-JSESSIONID cookie at all. If the php script does not set the WCC-ADF-JSESSIONID cookie (only the other cookie), the table remains completely empty.
So I can absolutely not reproduce the issue, it’s an exact string match for me.
Are you sure your table does not contain values from older tests, maybe you have peers configured so that the tables are synched back?
Can you show the entire configuration and the output of haproxy -vv?
Regarding the cookie regexp matches, it seems nonfunctional to me. But I also fail to see the real use-case. This probably never worked correctly; I assume there is no actual use-case for this, so I’m not sure if it’s worth the effort to fix it or (if it never worked in the first place) if it’s time to remove this functionality.