admin管理员组文章数量:1393035
I’m facing an issue where my Socket.io client fails to fully connect to a Socket.io server deployed on AKS.
- When running Socket.io locally, the client correctly receives the 40{"sid":"<socket_id>"} message, meaning the connection is successful.
- When connecting to the AKS-deployed server, the client only receives 40 without the sid, and the connection does not complete.
- The issue happens over wss://, but the same client works fine when connecting to a local server.
Server: Node.js with Socket.io ([email protected]
)
io.on("connection", (socket) => {
console.log("Socket connected:", socket.id);
});
Client: Angularapp ([email protected]
)
this.socket = io(";,
{
transports: ["websocket"],
path: "/nodeapp/socket.io/"
});
this.socket.on("connect", (socketdata:any) => {
console.log("Connected to server");
});
Deployment: AKS with NGINX Ingress Ingress Annotations:
ingress:
enabled: true
className: "nginx"
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/error-log-level: "debug"
nginx.ingress.kubernetes.io/enable-websocket: "true"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-buffering: "off"
nginx.ingress.kubernetes.io/proxy-body-size: "100m"
hosts:
- host:
paths:
- path: /nodeapp(/|$)(.*)
pathType: ImplementationSpecific
Why does the Socket.io client only receive 40 (without sid) when connecting via Ingress?
Could this be an issue with Ingress proxy headers stripping the sid?
Any known Azure or NGINX settings that affect WebSocket handshake completion?
Would appreciate any insights or troubleshooting tips!
Someone confirms a known issue with Socket.io, NGINX Ingress and suggests a fix.
I has been tried with load balancer also it's also showing same error it's seems to be connection not establish correctly but socket id is generated after io.on("connection",{})
.
本文标签:
版权声明:本文标题:kubernetes - Socket.io Client Not Connecting to AKS-Deployed Socket.io Server (Only Receiving 40 Without sid) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744669038a2618711.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论