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.