[GH-ISSUE #18231] issue: WebSocket Connection Fails Post-Handshake with WSS via Nginx Proxy #18539

Closed
opened 2026-04-20 00:46:03 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @kelsonbatista on GitHub (Oct 11, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/18231

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.6.33

Ollama Version (if applicable)

No response

Operating System

AlmaLinux 9.6 (Sage Margay)

Browser (if applicable)

Chrome Version 131.0.6778.204 (Official Build) (64-bit)

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

WebSocket connection via WSS should establish and maintain, showing messages like 0{"sid":"..."} in DevTools.

Actual Behavior

WebSocket handshake returns 101, but connection fails immediately, with browser error "WebSocket connection to ... failed". Polling works as fallback.

Steps to Reproduce

  1. Set up Open WebUI with Docker Compose (port 9200, ENABLE_WEBSOCKET_SUPPORT=true).
  2. Configure Nginx as described below.
  3. Access https:// in browser (incognito, logged in).
  4. Check DevTools (Network > WS) for failed WebSocket connection and console for error.
  5. Test with wscat -c 'wss:///ws/socket.io/?EIO=4&transport=websocket'.

Logs & Screenshots

Logs:

  • Nginx (/tmp/ws_access.log): Shows 101 for WebSocket requests, then connection closes.
  • Open WebUI (docker logs open-webui with LOG_LEVEL=DEBUG): No WebSocket-specific logs, only HTTP polling logs when ENABLE_WEBSOCKET_SUPPORT=false.

Tests Performed:

  • Direct WS (ws://127.0.0.1:9200/ws/socket.io/) succeeds.
  • WSS via wscat returns 101, but no messages (ex.: 0{"sid":"..."}).
  • Browser fails with "WebSocket connection to ... failed" in console.
  • Disabling WebSocket (ENABLE_WEBSOCKET_SUPPORT=false) enables polling, resolving the issue.

Additional Information

The WebSocket connection to wss://web.domain.com/ws/socket.io/?EIO=4&transport=websocket fails after a successful 101 Switching Protocols response. The browser console shows "WebSocket connection to ... failed", and no WebSocket connection appears in DevTools (Network > WS). Direct WS connection (ws://127.0.0.1:9200/ws/socket.io/) works, indicating the issue is with HTTPS/WSS via Nginx. Disabling WebSocket (ENABLE_WEBSOCKET_SUPPORT=false) resolves the issue by falling back to HTTP polling, but WebSocket is preferred for performance.

Environment:

Open WebUI Version: :main
Docker compose configured with:

  - LOG_LEVEL=DEBUG
  - ENABLE_WEBSOCKET_SUPPORT=true
  - CORS_ALLOW_ORIGIN=https://web.domain.com
  - WEBUI_URL=https://web.domain.com
  - ENABLE_SIGNUP=false
  - WEBUI_BIND_ADDRESS=0.0.0.0
  - DISABLE_AUTH=false
  - WEBSOCKET_AUTH_TOKEN_REQUIRED=false

Nginx configured with:

location ^~ / {
    proxy_pass http://127.0.0.1:9200;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Sec-WebSocket-Protocol "websocket";
    proxy_buffering off;
    proxy_connect_timeout 86400s;
    proxy_read_timeout 86400s;
    proxy_send_timeout 86400s;
}

Questions:

  • Is there a known bug in :main for WebSocket over HTTPS/WSS?
  • Any additional Nginx or Open WebUI settings to ensure WSS connection stability?
  • Suggestions for debugging post-handshake failure?

Additional Environment:

  • Server: VPS with Webuzo
  • Operating System: AlmaLinux 9.6 (Sage Margay)
  • Docker: Docker version 28.5.1, build e180ab8
Originally created by @kelsonbatista on GitHub (Oct 11, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/18231 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.6.33 ### Ollama Version (if applicable) _No response_ ### Operating System AlmaLinux 9.6 (Sage Margay) ### Browser (if applicable) Chrome Version 131.0.6778.204 (Official Build) (64-bit) ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior WebSocket connection via WSS should establish and maintain, showing messages like 0{"sid":"..."} in DevTools. ### Actual Behavior WebSocket handshake returns 101, but connection fails immediately, with browser error "WebSocket connection to ... failed". Polling works as fallback. ### Steps to Reproduce 1. Set up Open WebUI with Docker Compose (port 9200, ENABLE_WEBSOCKET_SUPPORT=true). 2. Configure Nginx as described below. 3. Access https://<domain> in browser (incognito, logged in). 4. Check DevTools (Network > WS) for failed WebSocket connection and console for error. 5. Test with wscat -c 'wss://<domain>/ws/socket.io/?EIO=4&transport=websocket'. ### Logs & Screenshots Logs: - Nginx (/tmp/ws_access.log): Shows 101 for WebSocket requests, then connection closes. - Open WebUI (docker logs open-webui with LOG_LEVEL=DEBUG): No WebSocket-specific logs, only HTTP polling logs when ENABLE_WEBSOCKET_SUPPORT=false. Tests Performed: - Direct WS (ws://127.0.0.1:9200/ws/socket.io/) succeeds. - WSS via wscat returns 101, but no messages (ex.: 0{"sid":"..."}). - Browser fails with "WebSocket connection to ... failed" in console. - Disabling WebSocket (ENABLE_WEBSOCKET_SUPPORT=false) enables polling, resolving the issue. ### Additional Information The WebSocket connection to `wss://web.domain.com/ws/socket.io/?EIO=4&transport=websocket` fails after a successful 101 Switching Protocols response. The browser console shows "WebSocket connection to ... failed", and no WebSocket connection appears in DevTools (Network > WS). Direct WS connection (`ws://127.0.0.1:9200/ws/socket.io/`) works, indicating the issue is with HTTPS/WSS via Nginx. Disabling WebSocket (`ENABLE_WEBSOCKET_SUPPORT=false`) resolves the issue by falling back to HTTP polling, but WebSocket is preferred for performance. Environment: Open WebUI Version: :main Docker compose configured with: ``` - LOG_LEVEL=DEBUG - ENABLE_WEBSOCKET_SUPPORT=true - CORS_ALLOW_ORIGIN=https://web.domain.com - WEBUI_URL=https://web.domain.com - ENABLE_SIGNUP=false - WEBUI_BIND_ADDRESS=0.0.0.0 - DISABLE_AUTH=false - WEBSOCKET_AUTH_TOKEN_REQUIRED=false ``` Nginx configured with: ``` location ^~ / { proxy_pass http://127.0.0.1:9200; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Sec-WebSocket-Protocol "websocket"; proxy_buffering off; proxy_connect_timeout 86400s; proxy_read_timeout 86400s; proxy_send_timeout 86400s; } ``` Questions: - Is there a known bug in :main for WebSocket over HTTPS/WSS? - Any additional Nginx or Open WebUI settings to ensure WSS connection stability? - Suggestions for debugging post-handshake failure? Additional Environment: - Server: VPS with Webuzo - Operating System: AlmaLinux 9.6 (Sage Margay) - Docker: Docker version 28.5.1, build e180ab8
GiteaMirror added the bug label 2026-04-20 00:46:03 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#18539