Per server rewriting

Here’s my case:
I got 2 HTTP endpoints, and
I’d like to be load balanced between and, but their paths differ. -> ->

I came across this question on ServerFault but it’s quite old by now.
How can I do this with HAProxy? Is there a way to rewrite the URI on a per server basis?