Sticky session with Tomcat jvmroute

Guys, I'm having a hard time implementing a Load Balancer Traefik V2 with serving as a proxy for Tomcat with sticky session.

Currently my application already works partially with the following settings:

        - traefik.enable=true
        - traefik.http.routers.tomcat.rule=Host(`app.exemple.com`) && PathPrefix(`/mypath/`)
        - traefik.http.services.tomcat.loadbalancer.server.port=8080
        - traefik.http.routers.tomcat.service=tomcat
        - traefik.http.routers.tomcat.entrypoints=web
        - traefik.http.services.tomcat.loadbalancer.sticky=true
        - traefik.http.services.tomcat.loadbalancer.sticky.cookie.name=StickyCookie

From then on I can't access my application, and from then on new problems arise.

My application is not configured to lose the session when refreshing the page and whenever I do this the session is destroyed using Traefik's LB.

My second problem is that some of my requests end up going to other containers in the cluster and this prevents me from running some tasks in the application, especially those that I consult an external service.

Ex: I use an external service to generate reports and the request for this service within the application is changed container and I cannot generate the report.

See that my access container is "http://10.0.6.90:8080"

[t29s5 ](http://172.23.0.31:888/#/tasks/t29s530zs8m3uk5bx7benvlcv?log=1) 10.0.0.2 - - [11/Oct/2021:02:54:02 +0000] "POST /webrun/executeRule.do HTTP/1.1" 200 63 "-" "-" 795 "tomcat@docker" "http://10.0.6.90:8080" 31ms

nd now he walks between two different containers. "http://10.0.6.101:8080" and "http://10.0.6.97:8080" thus having error 500 Internal Server Error

[t29s5 ](http://172.23.0.31:888/#/tasks/t29s530zs8m3uk5bx7benvlcv?log=1) 10.0.0.2 - - [11/Oct/2021:02:55:28 +0000] "GET /webrun/download?id=A60E20F2-64D7-454E-8FB3-F95275A7EB9E&hash=911119621632346077000&name=PM_Juazeiro&jsessionid=F8BA71714A6BDB1C0C0C8A7E72D584D5 HTTP/1.0" 500 383 "-" "-" 811 "tomcat@docker" "http://10.0.6.101:8080" 12ms

[t7znc ](http://172.23.0.31:888/#/tasks/t7znc4l1x2ynamx7f5uqqpde9?log=1) 10.0.0.2 - - [11/Oct/2021:02:55:29 +0000] "GET /webrun/download?id=A60E20F2-64D7-454E-8FB3-F95275A7EB9E&hash=911119621632346077000&name=PM_Juazeiro&jsessionid=F8BA71714A6BDB1C0C0C8A7E72D584D5 HTTP/1.0" 500 383 "-" "-" 633 "tomcat@docker" "http://10.0.6.97:8080" 2406ms

In other providers like Apache2 and NGINX I can work this normally, however I use Tomcat's jvmRoute. So I'm in doubt if there would be this possibility of Traefik or if there would be another solution to my problem.

Greetings from Brazil!!

Guys, I ended up opening a problem on github too, if you want to follow up.

Guys, I could see that whenever I call a download within my context, the traefik is lost.

As I use sticky sessions this download is never called by the same container where the client is connected and I see no reason for traefik to do this.

Everything works very normal except when I need to download any file.