Score:0

How do I get SignalR server deployed on AWS EKS behind nginx to allow websocket protocol connections?

eg flag

I have a .NET 6 Web API with SignalR. Everything works perfectly when connecting directly to the API - locally as well as via Endpoint IP:Port on AWS EKS. However, it's failing to connect specifically via the websocket transport method when I try to access it via the NGINX ingress URL (http://some.url.com). I get the following error:

Error: Failed to start the transport 'WebSockets': Error: WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.

The fallback transports (Server Sent Events) work after the initial websocket try fails but I ideally want to connect via websocket.

I've tried enabling sticky sessions but that doesn't seem to make a difference, as well as suggestions from https://stackoverflow.com/questions/48300288/signalr-in-asp-net-core-behind-nginx - I get the exact same error.

This is what my Ingress looks like:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-wsapp
  namespace: dev
  annotations:
    nginx.ingress.kubernetes.io/affinity: cookie
    nginx.ingress.kubernetes.io/read-timeout: '3600'
    nginx.ingress.kubernetes.io/send-timeout: '3600'
    nginx.ingress.kubernetes.io/configuration-snippet: |
      server {
        server_name some.url.com;

        location / {
          proxy_pass http://localhost:8081;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection $http_connection;
          proxy_set_header Host $host;
          proxy_cache_bypass $http_upgrade;
        }
      }
  namespace: dev
  labels:
    app: wsapp
spec:
  rules:
    - host: some.url.com
      http:
        paths:
        - path: /
          pathType: Prefix
          backend:
            service:
              name: wsapp
              port: 
                number: 8080
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.