Haproxy server persistance between different domains (transparent for server)


I’am trying to keep the same backend server for my whole “session”. The problem is that this “session” concerns 2 different domains. What’s more - servers should not know about another’s server cookie, so I cannot just use COOKIE option and programatically pass cookies between different requests.

It seemed to me the best option is to use:

balance hdr(myHeaderName)
http-request del-header myHeaderName

…and to programatically set a header for all requests in my “session” I’d like to delete this header with del-header, to make it transparent for the server (destination server, not proxy server).

So I set up my haproxy and try to make some requests:
curl --proxy -H ‘myHeaderName: 1’ "http://example.com"
curl --proxy -H ‘myHeaderName: 1’ "http://yahoo.com"
curl --proxy -H ‘myHeaderName: 2’ “http://example.com

First 2 requests should be handled with the same backend proxy server. Unfortunately, it doesn’t work, that means all 3 requests are being handled by a different server.

Removing “http-request del-header” make it work, but in such case, the server will receive my additional header, so that’s not enough for me.

Am I doing something wrong? Or is there a better option to achieve persistency between different domains requests?


Could anyone help me, please?