"Session expired" message displayed in control center
Problem
The HiveMQ Control Center can’t be used: after logging in, the UI keeps showing a “Session expired” message or sends the user back to the login page.
Cause
Each HiveMQ node keeps its own Control Center session. In a cluster, if requests from the same browser go to different HiveMQ nodes, the session isn’t found on the other node and the Control Center shows “Session expired”.
To prevent this, every hop between the browser and HiveMQ needs session stickiness, so that all requests from one user reach the same HiveMQ node.
Solution
A session expired message is observed when session stickiness is not configured.
If the Control Center is reached through a load balancer or reverse proxy, enable sticky sessions (session affinity) on it.Kubernetes with the HiveMQ Platform Operator
In your
hivemq-platformvalues file, set session affinity on the Control Center service explicitly:
services:
- type: control-center
exposed: true
containerPort: 8080
sessionAffinity:
type: ClientIPThe chart only applies ClientIP automatically when sessionAffinity is set or the service type isn’t LoadBalancer. Setting it explicitly avoids that gap, so always include it, especially with serviceType: LoadBalancer.
Kubernetes Ingress
If the Control Center is exposed through an Ingress, the Ingress controller sends traffic straight to the pods, so the Service’ssessionAffinityhas no effect. Enable sticky sessions on the Ingress instead. With the NGINX Ingress Controller, for example:
metadata:
annotations:
nginx.ingress.kubernetes.io/affinity: "cookie"For other Ingress controllers or cloud load balancers, refer to their documentation on cookie-based or client-IP session affinity.