Allow Configuring the "Domain" Property for Sticky Session Cookies #11542
Labels
area/service
area/sticky-session
contributor/wanted
Participation from an external contributor is highly requested
kind/enhancement
a new or improved feature.
Welcome!
What did you expect to see?
Currently, there is no way to specify the "Domain" attribute for the cookie used in sticky sessions. As a result, when using a load balancer, requests may be redirected to different servers if they are handled within a subdomain structure.
For example, if a system uses multiple subdomains (api.example.com, auth.example.com, app.example.com), the lack of a configurable domain property in the sticky session cookie prevents session persistence across these subdomains. This can lead to unexpected behavior, such as session loss or users being routed inconsistently between different backend servers.
Expected Behavior
It should be possible to define the "Domain" property for the session persistence cookie, allowing for greater flexibility in deployments where multiple subdomains need to share the same sticky session mechanism.
Use Case
A common scenario where this would be useful is when deploying microservices behind Traefik, where services reside on different subdomains but require session stickiness for proper functionality.
For example, setting:
would ensure that the session remains persistent across all subdomains of example.com.
Proposed Solution
Introduce an optional "Domain" configuration parameter within the sticky session cookie settings in Traefik, allowing users to define the appropriate scope for session persistence.
Additional Context
This feature would improve session management in multi-subdomain architectures, particularly in environments using authentication services, distributed applications, or microservices with frontend-backend separation.
The text was updated successfully, but these errors were encountered: