Thanks for elaborating. I'd be grateful for any resources or configuration examples that explain how to do this with haproxy in more detail. I couldn't really find anything, but then again, I'm not experienced with haproxy.
The example configurations I have seen around the web are not representative of what one can actually do with haproxy. Everything I know is from reading the source code and documentation.