I encountered a problem when deploying a socket application using signalr. I connect with the longpolling method and it still works, but the websocket gives an 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.
I think my ingress configuration has problem, but I still don't find it. Hope anyone can help me.
this's my ingress:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: socket-service-ingress
namespace: dev
annotations:
nginx.ingress.kubernetes.io/proxy-http-version: "1.1"
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
nginx.ingress.kubernetes.io/affinity: cookie
nginx.ingress.kubernetes.io/session-cookie-name: SIGNALR-AFFINITY
nginx.ingress.kubernetes.io/session-cookie-hash: sha1
spec:
rules:
- host: example.com
http:
paths:
- path: /socket-service/mainHub
pathType: Prefix
backend:
service:
name: socket-service
port:
number: 80