nginx-ingress 使用 websockets 时出现 400 错误

nginx-ingress 使用 websockets 时出现 400 错误

尝试在我的 k8s 集群上托管一个应用程序,特别是 Foundry VTT。它连接正常,但 websockets(任何以 开头的 URL/socket.io/都给出 400 错误。

在谷歌上搜索如何启用 websocket 支持,似乎我只需要添加代理发送/读取超时并将其设置为更高的值,我就是这样做的。

我尝试添加nginx.org/websocket-service注释,但没有效果。

 

Nginx 版本:Helm chart ingress-nginx-3.20.1;应用程序版本0.43.0

我的ingress.yml:

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: foundry
  labels:
    app: foundry
  annotations:
    kubernetes.io/ingress.class: nginx
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
    nginx.ingress.kubernetes.io/connection-proxy-header: "keep-alive"
    #nginx.ingress.kubernetes.io/enable-cors: "true"
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
    nginx.ingress.kubernetes.io/proxy-connect-timeout: '30'
    nginx.ingress.kubernetes.io/proxy-send-timeout: '3600'
    nginx.ingress.kubernetes.io/proxy-read-timeout: '3600'
    nginx.ingress.kubernetes.io/client-max-body-size: 512M
    nginx.ingress.kubernetes.io/configuration-snippet: |
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "Upgrade";
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
spec:
  tls:
    - hosts:
        - rpg.example.com
      secretName: foundry-tls
  rules:
    - host: rpg.example.com
      http:
        paths:
          - path: /
            backend:
              serviceName: foundry
              servicePort: http

相关内容