How to Configure Traefik for layer 4 with sticky session health Web API and web sockets

I am using windows environment not docker just simple windows server 2019 and it will be under company VPN. I have a backend server that host a single page application and a Web API plus web socket for push event both on same VM box but different port for SPA and Web API. Behind the web api I have few of services communicating over message bus. I have hosted two instance of my backend on two different machine and I want the Traefik load balancer in front of them to balance the load equally on both my backend server. I want sticky sessions, health and web socket. Is it possible using layer 4 like TCP router and TCP service or I have to use the HTTP router and HTTP services that might be slow on layer 7?

Thanks & Regards

I think is not possible because sticky session relay on an HTTP Cookie.
Best regards, Marcelo.

PD: Here a sample whoami with Sticky session definition:

    image: traefik/whoami:v1.6.0
    hostname: whoami-{{.Task.Slot}}
      mode: replicated
      replicas: 3
        - traefik.enable=true
        - traefik.constraint-label=traefik-public
        - traefik.http.routers.whoami.rule=Path(`/whoami`)

and here cookie response from service:

mochoa@pocho:~/docker/traefik$ curl -v --resolve -H
* Added to DNS cache
* Hostname was found in DNS cache
*   Trying
* Connected to ( port 80 (#0)
> GET /whoami HTTP/1.1
> Host:
> User-Agent: curl/7.68.0
> Accept: */*
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Length: 390
< Content-Type: text/plain; charset=utf-8
< Date: Sat, 09 Jan 2021 18:47:26 GMT
< Set-Cookie: StickyCookie=; Path=/
GET /whoami HTTP/1.1
User-Agent: curl/7.68.0
Accept: */*
Accept-Encoding: gzip
X-Forwarded-Port: 80
X-Forwarded-Proto: http
X-Forwarded-Server: 2b67f18683a8

Thanks. Can we run Traefik directly from windows 2016 Server without using docker?

I don't know. But if you install WSL2 support on Windows it will be able to run natively an Ubuntu 20.04 version which for sure runs Traefik.
Best regards, Marcelo.

The Traefik code is in Go, i think it should work on windows without any issue?

Hello @imtiazpk82,

Thanks for your interest in Traefik!

You can find the appropriate executable in each release: Release v2.4.0 · traefik/traefik · GitHub