Workaround for map_regm bug?


Hi there,

just tried to upgrade from 1.7.5 to 1.8.12, but was then bitten by a bug. My config has a map_regm directive to set a header, using a back reference; this doesn’t work any more, since the first character is being replaced by “00%”. A quick research seems to imply that it is a known problem, see

My map file looks lke

(.*)-somehost[1-9]\.domain\.com    \1                                                                                                                                                     
(.*)-otherhost[1-9]\.domain\.com    \1

Interestingly, I have another map file with backreference, and this seem not to have the “%00” problem:

.*-(somehost[1-9])\.domain\.com    \1
.*-(otherhost[1-9])\.domain\.com    \1

I’m using both for statements similar to

http-request set-var(txn.varname) var(txn.host_header),map_regm(/etc/haproxy/

obviously to extract parts of the FQDN. Not sure if it’s true, but it seems as if the bug only hits if the backrefence is about the beginning of the string to matched against.

I’m wondering how I could work around that bug. And, where would I report the bug, I couldn’t find a bug tracker for haproxy.

Thanks in advance



The mailing list, where you found this, is the correct place already. The bug has already been analyzed well by Jarno, but in this case, activity then ceased. I’ve now forwarded the report to the developer that authored the change.

There is the intention to use github issue as bug tracker for haproxy, but we are not quite there yet.


great, thanks a lot. How would I notice if it has been fixed? I suppose keeping an eye on changes to map.c?


There would be a answer in the mailing list thread that you found and unless I overlook it, I’d post an update in this discourse thread here as well.


just a little hint that apparently a patch has been implemented,

but it seem not yet make it into to the git repo, not visibly at;a=blob_plain;f=src/map.c;hb=HEAD




Right, the patch has been confirmed to fix the problem, I’m sure it will be committed shortly.