Enabling Sticky Sessions for the Portal in HA Mode
In a SAML-enabled environment running in High Availability (HA) mode—where multiple replicas of the Portal service are deployed behind a load balancer (such as a Kubernetes Service or an ingress controller)—it becomes essential to maintain Session Affinity, commonly known as Sticky Sessions. This ensures that once a session is established after SAML authentication, all subsequent requests from the user are routed to the same Portal instance.
Why Sticky Sessions are needed
Without Sticky Sessions, requests from the same user may be handled by different Portal pods, potentially resulting in:
-
Loss of session context (for example, user authentication state)
-
Intermittent logout or reauthentication issues
-
Inconsistent behavior during user interactions
Enabling Sticky Sessions prevents these issues by maintaining a stable connection between the client and a specific pod.
Configuring Sticky Sessions
To configure Sticky Sessions for a SAML-enabled environment running in High Availability (HA) mode—where multiple replicas of the Portal service are deployed behind a load balancer (Ingress Controller), you need to configure:
Configuring Sticky Sessions at Ingress level
Enabling Session Affinity at the Ingress level ensures stickiness even when the client's IP changes or is masked (for example, by a proxy).
To enable Session Affinity at the Ingress level, follow the steps below:
-
Run the following command to open the ingress rules in edit mode.
-
In the ingress rules, add or update the following annotations:
-
Save the file.
-
Restart the Ingress Controller to apply the changes.
Configuring Sticky Sessions in the portal service
To configure Sticky Session in the portal service, follow the steps below:
-
Open the global values.yaml file.
-
Go to the portal > sessionAffinity block.
-
Remove the empty curly braces (representing no configurations for Session Affinity)
-
Add the following Session Affinity configurations:
-
Restart the Portal and Webapp Gateway microservices.