Hello Christoph, On Wed, Nov 01, 2023 at 11:09:27AM +0100, Christoph Kukulies wrote: > During migration from an older site to a newer one with newer haproxy I find > that I have syntax errors in > haproxy.cfg: > > > The 'reqirep' directive is not supported anymore since HAProxy 2.1. Use > 'http-request replace-header' instead. > > > The directive to replace is: > > reqirep ^([^\ :]*)\ /(.*) \1\ /opencms/\2 > > Could someone help me to get the right sytax to achieve this with the new > directive?
It's always quite difficult to figure from a regex what it's trying to do, so explaining the intent with it tends to make it easier to respond. Here it seems your rule was meant to prepend "/opencms" in front of the value of any header field starting with a "/" (and which started with exactly one space but I guess that's just an overlook and an implementation detail in this case). Are you certain you want to do that for any header field name ? That sounds a bit surprising to me since it could break random headers that you're not thinking about. The only solution I'm seeing here is to enumerate the headers where you want to apply this rule (probably just Location ?), then to apply a similar rule as above using replace-header, e.g.: http-request replace-header location /(.*) /opencms/\1 Hoping this helps, Willy