Regrep to rewrite url

haproxy version is 2.2.9-2+rpi1+deb11u2
unknown keyword ‘repirep’ in ‘backend’ section

How to replace regrep ?
reqrep ^([^\ :])\ /(.) \1\ /ui/\2

global
	daemon
	maxconn 256

defaults
	mode http
	timeout connect 5000ms
	timeout client 50000ms
	timeout server 50000ms

frontend http-in
	bind *:80
	default_backend servers

backend servers
	reqrep ^([^\ :]*)\ /(.*)     \1\ /ui/\2
	server server1 127.0.0.1:1880 maxconn 32

Hello,

you can try with http-request replace-path :

# prefix /foo : turn /bar?q=1 into /foo/bar?q=1 :
http-request replace-path (.*) /foo\1

# strip /foo : turn /foo/bar?q=1 into /bar?q=1
http-request replace-path /foo/(.*) /\1
# or more efficient if only some requests match :
http-request replace-path /foo/(.*) /\1 if { url_beg /foo/ }

1 Like