It doesn't look like this is possible judging from the "Matching Layer 7" section of the configuration documentation. You might be able to pull it off with the payload feature but I have never tried this and it sounds like it was designed for session stickyness:
payload(offset,length)
This extracts a binary block of bytes, and starting
at bytes in the buffer of request or response
(request
on "stick on" or "stick match" or response in on "stick store
response").
That being said this seems like a strange thing to do to me. Having to pull data out of the payload seems like it would be processor intensive. This also seems like a nonstandard way to do this to me. If that is true, even if haproxy can do you might end up making haproxy a dependency of your application (Although I am a big fan of HAProxy, that is never a good idea). You can pull values out of the URL requests, the header, and cookies easily. So we might be able to help you more if you explain why you are looking at this solution.