Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Haproxy appears to provide a lot of abilities for content switching on HTTP Request headers (and URL, etc). However, I'm looking for a solution to choose a back-end based on matching a string (in a SOAP packet) in the HTTP Request body.

Has anyone a solution for that?

share|improve this question
Always fun to come across your own questions while searching for their answers… Haproxy dev is now at 1.5.x. Does anyone know if there's a way to do this with 1.5? – davemyron Aug 20 '12 at 22:37

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.

share|improve this answer
Thanks for the response, Kyle. I agree with you about dependencies. The scenario is that we have a third party partner (OpenMarket) that delivers MMS messages to us (in SOAP format). We have a dev cluster and a production cluster and, because of some limitations to the delivery mechanism, we receive messages for both at the same URL end point. Unfortunately, we have no control of that aspect -- so I was hoping to use something like Haproxy to do that content switching. – davemyron Dec 14 '10 at 18:40
@orangechicken: They come from different IPs by chance? – Kyle Brandt Dec 14 '10 at 18:43
I wish. Some of the requests come with additional headers -- which could of course utilize -- but some just differ in their SOAP message contents. It's interesting that you can look at the request's content's length but you can't search for a string in there like you can with a header. (Looking up a header by name and searching seems like it would be more CPU intensive than a string match in the payload... though I guess that could be a function of payload length) – davemyron Dec 14 '10 at 18:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.