# Poor man's stickiness

**URL:** <https://discourse.haproxy.org/t/poor-mans-stickiness/3498>\
**Category:** Help!\
**Created:** [February 9, 2019, 6:19pm UTC](https://discourse.haproxy.org/t/poor-mans-stickiness/3498 "2019-02-09T18:19:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![simonuk1](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@simonuk1](https://discourse.haproxy.org/u/simonuk1)\
**Post date:** [February 9, 2019, 6:19pm UTC](https://discourse.haproxy.org/t/poor-mans-stickiness/3498/1 "2019-02-09T18:19:58Z")

</div>

We have an application that isnt stateless, but i still want to have some spreading of the load.  
It has web and app servers behind web and app haproxy clusters.  
I was going to load / stick the web frontend based on source ip. However the web servers have to talk to the same app servers for the whole of the user’s session.

Anyone have any thought on how to do this.?

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [February 9, 2019, 10:10pm UTC](https://discourse.haproxy.org/t/poor-mans-stickiness/3498/2 "2019-02-09T22:10:26Z")

</div>

Please elaborate, it is not at all clear what you are trying to achieve.

Are you saying that you have a “web” haproxy cluster, with webservers behind it and then you also have a separate “app” haproxy cluster , with “app” servers behind it, the client accesses both, and there is some correlation between them, for example a client hitting webserver1 must also hit appserver1?

So the application will fail if the client hits webserver1 and appserver2?

---

<div class="post-metadata">

**Author:** ![simonuk1](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@simonuk1](https://discourse.haproxy.org/u/simonuk1)\
**Post date:** [February 9, 2019, 10:40pm UTC](https://discourse.haproxy.org/t/poor-mans-stickiness/3498/3 "2019-02-09T22:40:52Z")

</div>

The client accesses a website hosted on the webservers. The webserver serves information that it gets by accessing one of the app servers.  
One a users has logged into one of the webservers and the webserver has used one of the app servers, the combination of web and app must be used for the users session.

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [February 10, 2019, 11:10am UTC](https://discourse.haproxy.org/t/poor-mans-stickiness/3498/4 "2019-02-10T11:10:01Z")

</div>

And the protocol between the webserver and the appserver is HTTP I guess?

If I’d be forced to work with this terrible design, I’d use cookie persistence however that requires that the webserver correctly handles cookies towards the appserver. Otherwise you’d have to figure out some other identifying information (like a session ID) in the request of the webserver that makes it possible for haproxy to stick to the same app server.

---

<div class="post-metadata">

**Author:** ![simonuk1](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@simonuk1](https://discourse.haproxy.org/u/simonuk1)\
**Post date:** [February 10, 2019, 11:29am UTC](https://discourse.haproxy.org/t/poor-mans-stickiness/3498/5 "2019-02-10T11:29:18Z")

</div>

Yeah http, agreed its a terrible design.  
Yeah was thinking some sort of cookie persistence or session id.

Cheers
