I have an AWS "Classic Load Balancer" that relays the traffic and for 3 EC2 instances. On these EC2 instances (it's simple Linux machines) I have a GlassFish 4.1 running and listening to port 80.
When calling the URL for a single server, everything is fine (works as it is supposed to) but when the traffic is relayed by the Load Balancer, the request to the application server has no cookies.
I checked the balancer's "Enable load balancer generated cookie stickiness" option and also tried "Enable application generated cookie stickiness". Both times the balancer chooses a target server for the first request and uses relays all subsequent requests to the same server - but omits the cookies.
After the login I have these cookies:
AWSELB DD17B9.... JSESSIONID 8f22ce.... mnzkks 1869:1000:34....
When I click on any link on the page, I see that my browser includes the new cookies in the request:
GET /mypage/detail HTTP/1.1 Host: my.page.com Connection: keep-alive Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 OPR/45.0.2552.888 Referer: https://my.page.com/dashboard Cookie: JSESSIONID=8f22ce ...; AWSELB= DD17B9....; mnzkks=1869:1000:345..
In a filter of my application I print out all the cookie names and check for the "mnzkks". If I can't find any cookie it prints
no cookie :)
When using the server's original URL it prints
AWSELB JSESSIONID mnzkks
When using the URL of the balancer it always prints
no cookie, even though the browser includes all 3 cookies in the request
who ate my cookies?