On Fri, Nov 17, 2023 at 10:26:32AM +0100, 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 127.0.0.1:8080 > > > Actually I'm used the write multiple patterns as \(pattern1\)\(pattern2\). So > is it a different regex syntax? > > 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 > > 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?
No, it's not spaces in URL. The reqirep rules used to apply to whole lines of the request (first line and headers). The pattern "^([^\ :]*)\ " was used to make sure it only applied to the request line since only this line could have a space before a colon, so this used to do this: ^([^\ :]*)\ /(.*) \1\ /opencms/\2 <--------> <--> \1 /opencms/\2 meth: \1 url:\2 So that would prefix "/opencms/" in front of the existing URI on the request line. That's why your replace-header directive doesn't match this at all. In your case I guess the simplest equivalent would be to just prepend /opencms/ before the path: http-request set-path /opencms/%[path] or even cleaner without the double-slash: http-request set-path /opencms%[path] I have no idea where this "Destination" header came from, though. Maybe someone previously copied the whole request line into it for debugging ? Willy