HAProxy community

Trouble with case insensitive redirect maps when they contain a number


Having some trouble using case insensitive redirect maps, normally we’d pass the -i flag but from my understanding this isn’t possible when using a map the way we are now.

Our solution was to use the lower filter as below, but this while allowing case insensitive matching it breaks when passed numbers as a source.

http-request redirect location %[path,lower,map(/etc/haproxy/redirect.map)] code 301 if { path,lower,map(/etc/haproxy/redirect.map) -m found } is_redirect_map

This currently works fine for anything which doesn’t have a number in e.g.

example.com/abcd -> example.com/alphabet

will match on any of the following:

example.com/AbcD, example.com/abcd, example.com/ABcd

However the following does not work.

example.com/abcd123 -> example.com/alphabet

would not match at all when using the lower filter. This only seems to be a problem on the source, I’ve not seen an issue with using destinations with numbers using the lower filter.