0

We currently have a the following setup:

[Client] -> [haproxy] -> [Nginx] -> [App Servers]

Nginx currently sets the cookie affinity to the app servers by setting a cookie i.e: public-client. However with the introduction of HAProxy the cookie is not present on the client side and session affinity to the app servers are broken.

I was wading through the documentation and came across an attribute called appsession that may have worked but it looks like it is deprecated. The recommendation is to use stick-table but i'm not quite sure how to go about preserving a cookie with that attribute.

Does anyone know how this can be accomplished?

Note: I'm fully aware of the duplication of reverse proxies but our architecture requires it.

Problem Discovered

So based on the comment below I ran tcdump on the HAProxy and Nginx server to validate where the cookie wasn't getting set/passed.

The command I ran for reference:

sudo /usr/sbin/tcpdump -A -l dst port 80 -i any | grep "^Cookie: "

This showed me application cookies on HAProxy and Nginx servers. However the cookie that Nginx was supposed to set wasn't in the traffic flow to HAProxy which isolated the problem to Nginx not setting the cookie.

kaizenCoder
  • 343
  • 2
  • 8
  • 22
  • 1
    I think before looking to stickiness with HAProxy, you need to now why the cookie is not present in the HAProxy request ? if the cookie is present in the client request then HAProxy should keep it. – Mo3m3n Mar 22 '18 at 12:29
  • good point which led me to finding out that the Nginx was not setting the cookie. – kaizenCoder Mar 24 '18 at 04:28

0 Answers0