Good morning everyone …
i try deploy websocket app in cluster rancher using ingress as incoming but can’t pass traffic wss with error unknow:transport (wss://rancher01.xxxxx/demo/wc/socket.io/?EIO=3&transport=websocket ERR_UNKNOWN_URL_SCHEME)
when i change to https ( https://rancher01.xxxxxx/demo/wc/socket.io/?EIO=3&transport=websocket {“code”:0,“message”:“Transport unknown”} )
Then i try check socket.io.js can access https://rancher01.xxxxx/demo/wc/socket.io/socket.io.js
/*!
* Socket.IO v2.4.0
* (c) 2014-2021 Guillermo Rauch
* Released under the MIT License.
*/
Cluster was deploy using K8s was using v1.218 with ingress nginx.This app was before working in AWS ALB in instance and ECS .
Here my service and ingress :
---
apiVersion: v1
kind: Service
metadata:
name: wc-service
namespace: nodejs
spec:
type: NodePort
ports:
- port: 7000
targetPort: 7000
protocol: TCP
name: wc-service
selector:
app: wc-nodejs
---
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
namespace: "nodejs"
name: "wc-service"
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/cors-allow-origin: "*"
nginx.ingress.kubernetes.io/cors-allow-methods: PUT, GET, POST, OPTIONS, DELETE, PATCH
nginx.ingress.kubernetes.io/server-snippets: |
location ~/demo/wc/(*.) {
proxy_set_header Upgrade $http_upgrade;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_set_header Connection "upgrade";
proxy_cache_bypass $http_upgrade;
proxy_pass http://127.0.0.1:7000/demo/wc/$1$is_args$args
}
spec:
rules:
- host: rancher01.xxx.xom
http:
paths:
- path: /demo/wc
pathType: Prefix
backend:
service:
name: cs-service
port:
number: 7000