Websocket connection failure using ingress in kubernetes

We are migrating our documentserver to kubernetes. The setup has gone fairly smoothly using the guide at https://github.com/ONLYOFFICE/Kubernetes-Docs?tab=readme-ov-file#51-example-deployment-optional. But when testing with the “example” server, I’m seeing websocket connection failures in the Network tab of browser inspector.

I have configured helm values with ingress.enabled: true to use the existing ingress-nginx controller in the cluster.

I was able to get websocket connections working with the following annotation:

    nginx.ingress.kubernetes.io/server-snippet: |
     location /8.1.3-4/doc {
      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;
     }

But that config breaks regular http(s) connections.

I’ve looked at the examples at https://github.com/ONLYOFFICE/document-server-proxy/blob/feature/virtual-path/nginx/proxy-to-virtual-path.conf but those appear to be for configuring nginx directly, not via annotations for the nginx controller in a cluster.

We are using the enterprise version of the container images.

Do you have examples for getting docservice to work using ingress-nginx controller in a kubes cluster?

In case anyone else ends up here…

The problem was RabbitMQ auth failing. The pods would restart so I wasn’t seeing the errors in the logs. When I watched the logs live, I could see the errors. (There was also an error with statsd metrics collection.)

The auth failing must cause websocket connection failures, so that was red herring in the browser.

Once all those errors were resolved, websocket and plain http connections are both working.

Hello @cngarrison

Good job. Also thanks for sharing the details with the community.
Closing this topic as solved.