0

I have an haproxy server and I need it to rewrite the URL.

For example, I have a url that is like this:

http://myserver.com/UserName/signalr/.....

and I need to remove the UserName, so when haproxy forwards to the server the url becomes:

http://myserver.com/signalr/.....

if I know the UserName then this works:

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

My problem is that the UserName is not a static, but always in the same place in the URL, directly after the domain.

Any help appreciated.

h3li0s
  • 613
  • 9
  • 25

2 Answers2

0

Use the regex http:\/\/myserver.com\/(\w+) to determine the username directly after the domain. The first captured group is the username.

John Doe
  • 1,364
  • 1
  • 12
  • 19
0

I did find a solution to this if anyone is interested

reqrep ^([^)((?:[^\/]*\/){1}[^\/]*\/(.*)     \1\2
h3li0s
  • 613
  • 9
  • 25