I have haproxy successfully running on one server with multiple instances of 
our app. What I tried to do was bring it up on a second server configured 
similarly. 

Right now we are using cookies for session persistence and it works well with a 
single server. 

After bringing on the second server and setting up two DNS A records I’ve 
notice some issues.

Some times the browser will apparently end up requesting different things from 
the two different servers. I didn’t really expect this behavior, but I can see 
in the developer tools that it is in fact getting cookies from both servers and 
this is making the app fail.

From what I’ve read it seems like I need to peer the two servers so if a 
request with a cookie comes in on the second server haproxy will forward that 
request to the correct instance on the first server.

Does this make sense, and if so do I need to configure a stick table somehow or 
am I barking up the wrong tree?

Also, it seems that it’s the image requests that typically might end up going 
to a different server. Sometimes these come through with no cookie, especially 
if it’s the first time the site is loading. The app framework is apparently 
setup for image links to use the actual session id in the url to the image. 

So the link might look like this:

https://server2.domain.com/longstringofcharsthatisasessionid/files/%7B9673-7301-0970-2310-9272%7D/background.png

Is it possible to read the sessionid cookie of the first response so that when 
a request comes through with the sessionid in the url I can direct it to a 
particular instance of the app?


Thanks,
Kevin

Reply via email to