How to make websocket (wss) work with kubernetes ingress (traefik v2.9.6)

We have got a self hosted Kubernetes cluster with traefik 2.9.6 as the ingress controller, there is an nginx server in front of the traefik which handles ssl/https termination and it then gets routed to traefik ingress's web endpoint.. everything works great!

We are having an issue with an ingress which utilize WebSockets (WSS) and unfortunately it doesn't seems to work with the traefik setup (getting an error saying Websocket Disconnected. Attempting Reconnection.). I came across this post (WebSockets not working after migrating to Traefik 2.0 - #2 by ros) and tried adding a middle-ware as follows but it didn't help. I would appreciate any insights or suggestions on how to fix this issue. Thanks!

apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: ssl-header
spec:
  headers:
    customRequestHeaders:
      X-Forwarded-Proto: https

I managed to make it work by modifying the middleware specification as follows, Thanks!

apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: ssl-header
spec:
  headers:
    customRequestHeaders:
      Connection: keep-alive, Upgrade
      Upgrade: WebSocket

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.