Erase path prefix to able it for a application

Hey everyone!

Im trying to make haproxy rewrite url’s to make them function with a webapplication that a supplier got. The application dont understand prefix (paths) and needs it to be erased before it ends up in the specific backend. I want to use one subdomain and direct to different backends depending on the path.

The issues I get is either everything is going to the specific backend or everything goes to the default backend. Sometimes I also get a 503 error in the browser.

This is my frontend config:

frontend port443-admin
bind *:443 ssl crt /etc/haproxy/certs/ strict-sni
mode http
maxconn 2000
option httplog

acl admin hdr(host) -i
acl test-site path_beg /test-site

# Use backend admin-test-site if the complete url is
use_backend admin-test-site if admin test-site

# Erase the /test-site to make it readable for the webapplication
http-request set-path %[path,regsub(/test-site,/)] if admin test-site

# Use webbsite if anything than complete url
default_backend www-zafe-se

Im very new to haproxy so Im for every help I can get :slight_smile: