I've got a web app running in tomcat instances on EC2 and I can't for the life of me get sticky sessions to work on the load balancer. I've followed all the steps in http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-sticky-sessions.html, tried using both the application-based (using the JSESSIONID cookie) and time-based (using 86400 seconds) methods, but either way, it doesn't work, at all. The same user keeps getting bounced around all the different nodes.. every time they click a new link on the webpage, it bounces them back to the home screen to login again.
I have no idea why it isn't working. I also don't know very much about this stuff (heck, until 2 hours ago I didn't even know what 'sticky session' meant--and no, I can't just get someone else to do it) so I'm not really sure where to start with debugging it, either.
EDIT: Looking at my cookies.. it appears that the AWSELB cookie keeps getting deleted and rewritten every single time I load the site, instead of persisting like it's supposed to.
EDIT 2: XML configuration of my load balancer:
{
"LoadBalancerDescriptions": [
{
"Subnets": [
"subnet-5c83aa39",
"subnet-6a778830",
"subnet-c41cdde8"
],
"CanonicalHostedZoneNameID": "Z35SXDOTRQ7X7K",
"CanonicalHostedZoneName": "<ELB_NAME>-<redacted>.us-east-1.elb.amazonaws.com",
"ListenerDescriptions": [
{
"Listener": {
"InstancePort": 5432,
"LoadBalancerPort": 5432,
"Protocol": "TCP",
"InstanceProtocol": "TCP"
},
"PolicyNames": []
},
{
"Listener": {
"InstancePort": 8888,
"LoadBalancerPort": 8888,
"Protocol": "HTTP",
"InstanceProtocol": "HTTP"
},
"PolicyNames": [
"AWSConsole-LBCookieStickinessPolicy-<ELB_NAME>-1500995555135"
]
}
],
"HealthCheck": {
"HealthyThreshold": 2,
"Interval": 10,
"Target": "HTTP:44554/",
"Timeout": 8,
"UnhealthyThreshold": 4
},
"VPCId": "vpc-721bec0b",
"BackendServerDescriptions": [],
"Instances": [
{
"InstanceId": "i-0ca9c244ed930d58f"
},
{
"InstanceId": "i-0cf47dc916f3f3443"
},
{
"InstanceId": "i-09ce2f24abc50259f"
}
],
"DNSName": "<ELB_NAME>-<redacted>.us-east-1.elb.amazonaws.com",
"SecurityGroups": [
"sg-f5ff638b"
],
"Policies": {
"LBCookieStickinessPolicies": [
{
"PolicyName": "AWSConsole-LBCookieStickinessPolicy-<ELB_NAME>-1500564994754",
"CookieExpirationPeriod": 86400
},
{
"PolicyName": "AWSConsole-LBCookieStickinessPolicy-<ELB_NAME>-1500565103581",
"CookieExpirationPeriod": 0
},
{
"PolicyName": "AWSConsole-LBCookieStickinessPolicy-<ELB_NAME>-1500566463445",
"CookieExpirationPeriod": 28800
},
{
"PolicyName": "AWSConsole-LBCookieStickinessPolicy-<ELB_NAME>-1500566440580",
"CookieExpirationPeriod": 0
},
{
"PolicyName": "AWSConsole-LBCookieStickinessPolicy-<ELB_NAME>-1500476922828",
"CookieExpirationPeriod": 86400
},
{
"PolicyName": "AWSConsole-LBCookieStickinessPolicy-<ELB_NAME>-1500481383343",
"CookieExpirationPeriod": 86400
},
{
"PolicyName": "AWSConsole-LBCookieStickinessPolicy-<ELB_NAME>-1500479370743",
"CookieExpirationPeriod": 86400
},
{
"PolicyName": "AWSConsole-LBCookieStickinessPolicy-<ELB_NAME>-1500475843862",
"CookieExpirationPeriod": 86400
},
{
"PolicyName": "AWSConsole-LBCookieStickinessPolicy-<ELB_NAME>-1500995555135",
"CookieExpirationPeriod": 86400
}
],
"AppCookieStickinessPolicies": [
{
"PolicyName": "AWSConsole-AppCookieStickinessPolicy-<ELB_NAME>-1500477157435",
"CookieName": "JSESSIONID"
},
{
"PolicyName": "AWSConsole-AppCookieStickinessPolicy-<ELB_NAME>-1500472642494",
"CookieName": "JSESSIONID"
},
{
"PolicyName": "AWSConsole-AppCookieStickinessPolicy-<ELB_NAME>-1500473344752",
"CookieName": "JSESSIONID"
},
{
"PolicyName": "AWSConsole-AppCookieStickinessPolicy-<ELB_NAME>-1500473227851",
"CookieName": "JSESSIONID"
}
],
"OtherPolicies": []
},
"LoadBalancerName": "<ELB_NAME>",
"CreatedTime": "2017-07-18T15:32:33.890Z",
"AvailabilityZones": [
"us-east-1a",
"us-east-1b",
"us-east-1c"
],
"Scheme": "internet-facing",
"SourceSecurityGroup": {
"OwnerAlias": "558554867759",
"GroupName": "<redacted>"
}
}
]
}
EDIT 3: Anyone? Please I'm getting desperate I need this to work...
aws elb describe-load-balancers --load-balancer-name my-loadbalancer
– Earshot