Why not use subdomains? app1.mydomain app2.mydomain and use haproxy to send those to the correct webserver? Sounds like a way simpler approach?
As for rewriting the 'body' of a request or response, thats something that haproxy does not support (yet). Though with lua scripting there are some options to try and implement such a thing yourself, probably wont be easy though..