HAProxy reqrep remove URI on backend request

You have this:

reqrep ^([^\ ]*)\ /web1/(.*)     \1\ /\2

I think you want this:

reqrep ^([^\ ]*\ /)web1[/]?(.*)     \1\2

The difference being that the second one will work if the / after webN is omitted.

In answer to your comment below, going in to detail about how the expressions above work is more effort than I can give. However, maybe this will help.

Everything before /web1 is "capturing" everything that comes before web1 in the request string. So usually that would be GET or POST. The (.*) "captures" everything after web1, including nothing if there is nothing.

The next part (\1\2) says what to do with those captured parts. It says to form a string composed of \1 (the first captured part) and \2 (followed by the second captured part). Since web1 is never captured, it's not assembled in to the final output.