Session Expired error when on more than one pod on Kubernetes load balancer

We’ve facing an issue after deployment where our application shows the Session Expired error below when running on more than one pod on Kubernetes load balancer.

We then tried to replicate this situation locally by building two copies of the app and running them with NGINX load balancer. Once again we face the Session Expired error coming out everytime we refresh the page.

We’ve tried a few suggested solutions found on the web such as

  • setting cuba.web.pushLongPolling to true
  • setting cuba.web.pushEnabled to false
  • setting cuba.web.uiHeartbeatIntervalSec to 0

So far we have yet to resolve the issue with all the suggestions above. Appreciate if anyone could point us to the right direction. Thanks.

You need to use a sticky session load balancer.
For NGINX - use “ip hash” balancing method.
This is because Vaadin UI stores all UI in the web session, and this session is too big in size, so one can’t set up session replication between pods. Web session of any user can be stored only on one pod at once, particular user can be served only by one pod.

This information is noted here Application Scaling - CUBA Platform. Developer’s Manual

Thank you @albudarov, based on your comment our team managed to resolve this with sessionAffinity setting in Kubernetes.