Hi Christoph.
On 2023-11-17 (Fr.) 10:26, Christoph Kukulies wrote:
I have the following line in my config:
backend website
http-request replace-header Destination ^([^\ :]*)\ /(.*) \1\ /opencms/\2
server www.mydomain.org <http://www.mydomain.org> 127.0.0.1:8080
Actually I'm used the write multiple patterns as \(pattern1\)\(pattern2\). So is
it a different regex syntax?
The regex of HAProxy is explained here.
http://docs.haproxy.org/2.8/configuration.html#7.1.4
In addition could be this part interesting for you.
Quoting and escaping http://docs.haproxy.org/2.8/configuration.html#2.2
The "http-request replace-header ..." is documented here.
http://docs.haproxy.org/2.8/configuration.html#4.2-http-request%20replace-header
The main documentation for http-request is here
http://docs.haproxy.org/2.8/configuration.html#4-http-request where you can see
all supported options for that keyword.
Maybe the replace-header is not the right one for the "reqirep ..." line below
as the reqirep keyword have handled all parts of the URL and Header and you have
to figure out which part do you want now to replace, is it a header, a url part
or a path part.
Maybe this answers helps you too.
https://stackoverflow.com/questions/75653221/replace-reqirep-directive-in-haproxy-2-2-25/75653335#75653335
https://discourse.haproxy.org/t/the-reqrep-directive-is-not-supported-anymore-since-haproxy-2-1/5147
The other question - since I don't understand the above statement at all - what
does it exactly do?
With 2.4 the corresponding line was (instead of the replace-header):
reqirep ^([^\ :]*)\ /(.*) \1\ /opencms/\2
This could not be the only line in the section. Please be so kind and share the
whole config without any sensible data or the link from which you have copied
the haproxy config.
The documentation for reqirep is here
http://docs.haproxy.org/2.0/configuration.html#4-reqirep
Let me try to translate the regex:
substitute
pattern1: begin-of-line followed by not blank and not colon repeatedly,
followed by a blank, followed by
pattern2: any char repeatedly
by
<pattern1><blank> /opencms/<pattern2>
But the interspersed space don't make sense to me. spaces in URLs?
>
Thanks in advance,
--
Christoph
Regards
Alex