ByteAlex
ByteAlex

Reputation: 41

Kubernetes Traefik Ingress using WebSockets sending 500's

Hello and thanks for reading!

We've been trying to setup a secure web socket via traefic to a spring webserver. The connection is inbound to traefik via HTTP/2. The IngressRoute (HttpRouter) responsible for this endpoint is doing the SSL termination and moving the traffic to a TraefikService with scheme http. We tried several variants, with middleware which append Headers like "X-Forwarded-Proto: https", but still the furthest we could get is as follows: The Spring WebServer did accept the connection, but it instantly got terminated with SC 500 again and no response was sent to the client.

Am I missing any configuration for the setup as described above?

Note: Traefik does not show any error logs and the Spring webservice only tells that the connection was interrupted.

Configuration snippets (commented out parts were tried before but didn't work either) Middleware:

apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: wss-headers
  namespace: rc
spec:
  headers:
    customRequestHeaders:
      Connection: "keep-alive, Upgrade"
#      Connection: "Upgrade"
#      X-Forwarded-Proto: "https"
      Upgrade: "WebSocket"
#      X-Forwarded-Port: "443"

WSS ingress:

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: uiserver-ws-ing
  namespace: rc
spec:
  tls:
    secretName: tls-example.org
    options:
      namespace: rc
    domains:
    - main: example.org
      sans:
      - example.com
  routes:
  - kind: Rule
    priority: 100
    match: Host(`example.org`) && PathPrefix(`/ws`)
#    middlewares:
#    - name: wss-headers
    services:
    - name: uiserver-svc
      namespace: rc
      port: 8080
      scheme: http
#      scheme: h2c

Thank you & Best Regards, Alex

Upvotes: 3

Views: 1532

Answers (0)

Related Questions