Search code examples
sessioncookiesdocker-swarmtraefik

Traefik sticky session not working in docker swarm


I have a problem in Traefik reverse proxy: it uses an own cookie to store the backend server ip address, but sometimes this is not working properly because the path of the cookie is not '/' but it uses the webpage default for instance '/myapp/page'.

My problem is that the application also uses an other path like '/myapp/api', but that is routed to another instance.

As it is a legacy application I cannot store the session data in an other external session store. I use docker swarm to manage docker containers.

How can I set the path of the cookie in Traefik?


Solution

  • For now, you cannot customize the cookie path -- Traefik currently does not set it at all (which is a known issue).

    There have been considerations in the directions of always setting the root path (/) and/or determining the path from the frontend path. Feel free to chime in on the existing issue or create a new one if you feel that Traefik is missing a need for customization in this regard.