I'm setting up HAProxy and I need to route based on API versions. The issue is that V2 doesnt have the prefix embedded in the router while v1 does. Here is an example.
v1 app route = server/v1/path v2 app route = server/path
I need to configure HA so it will route server/v2/path to /server/path while returning a 200 and not a 302 status code. I do not want api users to know anything different than /server/v2/path
This is my config, everything defaults to v2.
frontend api
bind *:80
stats uri /ls
acl url_v1 path_beg /v1
use_backend api_v1 if url_v1
default_backend api_v2
backend api_v2
balance roundrobin
server v1 ip:80 check
backend api_v1
server v1 ip:80 check