Hii, we have deployed the livekit onprem version a...
# ask-ai
l
Hii, we have deployed the livekit onprem version and locally i have voice agent and deployed the livekit with a domain, when i try to use this url im getting websocket connection error. and also the route is going for /agent but when we use livekit cloud version its working and not going for /agent we need help on this
Copy code
{
  "message": "failed to connect to livekit, retrying in 4s",
  "level": "WARNING",
  "name": "livekit.agents",
  "exc_info": "Traceback (most recent call last):\n  File \"C:\\Users\\Sahil Dutta 2\\Desktop\\axl\\axlai-voice-livekit\\venv\\Lib\\site-packages\\livekit\\agents\\worker.py\", line 649, in _connection_task\n    ws = await self._http_session.ws_connect(\n         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"C:\\Users\\Sahil Dutta 2\\Desktop\\axl\\axlai-voice-livekit\\venv\\Lib\\site-packages\\aiohttp\\client.py\", line 1084, in _ws_connect\n    raise WSServerHandshakeError(\naiohttp.client_exceptions.WSServerHandshakeError: 404, message='Invalid response status', url='wss://<domain>/agent'",
  "timestamp": "2025-09-05T05:19:25.009235+00:00"
}
t
Thanks for reaching out, Sathish. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd love to help you get to the bottom of this! Could you please share a bit more about your on-prem deployment setup? For example: • Are you using a reverse proxy like Nginx in front of LiveKit? • Have you set up SSL/TLS certificates for your domain yet? • Which ports do you have open and accessible for LiveKit services? Having these details will really help us understand what's causing the WebSocket connection error and find the best solution for you. Sources: Diagnosing Connection Errors with Connection Test Utility | Knowledge Management System | livekit/livekit_composite | DeepWiki | livekit-api/src/signal_client/signal_stream.rs | livekit-plugins/livekit-plugins-soniox/livekit/plugins/soniox/stt.py | test/stream.go
l
we are not using nginx but we are using nginx-ingress so we might have applied some apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: livekit-server-ingress annotations: # For NGINX Ingress Controller (most common) kubernetes.io/ingress.class: "nginx" kubernetes.io/proxy-read-timeout: "3600" kubernetes.io/proxy-send-timeout: "3600" kubernetes.io/server-snippets: | location / { proxysetheader Upgrade $httpupgrade; # upgrade header demands upgrade on the same tcp conn. proxyhttpversion 1.1; proxysetheader X-Forwarded-Host $httphost; proxysetheader X-Forwarded-Proto $scheme; proxysetheader X-Forwarded-For $remoteaddr; proxysetheader Host $host; proxysetheader Connection "upgrade"; proxycachebypass $httpupgrade; } spec: # Change this to match your ingress controller ingressClassName: nginx # or "azure-application-gateway" for Azure App Gateway tls: - hosts: - ** secretName: livekit-tls rules: - host: * http: paths: - path: / pathType: Prefix backend: service: name: livekit-service # Service name created by Helm chart port: number: 7880 7880 port opened while connecting getting this {"message": "failed to connect to livekit, retrying in 4s", "level": "WARNING", "name": "livekit.agents", "exc_info": "Traceback (most recent call last):\n File \"C:\\Users\\Sahil Dutta 2\\Desktop\\axl\\axlai-voice-livekit\\venv\\Lib\\site-packages\\livekit\\agents\\worker.py\", line 649, in _connection_task\n ws = await self._http_session.ws_connect(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"C:\\Users\\Sahil Dutta 2\\Desktop\\axl\\axlai-voice-livekit\\venv\\Lib\\site-packages\\aiohttp\\client.py\", line 1084, in _ws_connect\n raise WSServerHandshakeError(\naiohttp.client_exceptions.WSServerHandshakeError: 404, message='Invalid response status', url='wss://<domain>/agent'", "timestamp": "2025-09-05T051925.009235+00:00"}
t
Thanks for sharing your setup with nginx-ingress! Let’s work through some steps together to help resolve the WebSocket connection issue you’re experiencing: • First, please double-check that your nginx-ingress configuration includes the right annotations to support WebSocket connections. For example:
Copy code
<http://nginx.ingress.kubernetes.io/proxy-read-timeout|nginx.ingress.kubernetes.io/proxy-read-timeout>: "3600"
<http://nginx.ingress.kubernetes.io/proxy-send-timeout|nginx.ingress.kubernetes.io/proxy-send-timeout>: "3600"
<http://nginx.ingress.kubernetes.io/websocket-services|nginx.ingress.kubernetes.io/websocket-services>: "livekit-service"
<http://nginx.ingress.kubernetes.io/proxy-set-headers|nginx.ingress.kubernetes.io/proxy-set-headers>: |
  Upgrade: $http_upgrade
  Connection: "upgrade"
• It’s also a good idea to verify that the TLS certificate you’re using in your ingress configuration is valid and trusted by your clients. • Make sure that port 7880 is open and accessible, as this is important for WebSocket signaling. • Lastly, check that the WebSocket URL (like `wss://your-domain/agent`) is correctly routed to your LiveKit service. If you’re still running into issues, could you please let me know if the WebSocket URL might be getting rewritten or blocked by any other ingress rules or network policies? I’m here to help you get this sorted out! Sources: examples/egress.yaml | Self-hosting the Ingress Service | LiveKit Docs | README.md | Docs::Home