fix(api): raise Socket.IO max_http_buffer_size for large workflows (#41347)

This commit is contained in:
lei_lei
2026-08-27 11:48:42 +00:00
committed by GitHub
parent 9c16c86597
commit 8c25190713
6 changed files with 19 additions and 0 deletions
+1
View File
@@ -222,6 +222,7 @@ SUPABASE_URL=your-server-url
# CORS configuration
WEB_API_CORS_ALLOW_ORIGINS=http://localhost:3000,*
CONSOLE_CORS_ALLOW_ORIGINS=http://localhost:3000,*
WEBSOCKET_MAX_HTTP_BUFFER_SIZE=10485760
# When the frontend and backend run on different subdomains, set COOKIE_DOMAIN to the sites top-level domain (e.g., `example.com`). Leading dots are optional.
COOKIE_DOMAIN=
+10
View File
@@ -593,6 +593,16 @@ class HttpConfig(BaseSettings):
def CONSOLE_CORS_ALLOW_ORIGINS(self) -> list[str]:
return self.inner_CONSOLE_CORS_ALLOW_ORIGINS.split(",")
WEBSOCKET_MAX_HTTP_BUFFER_SIZE: PositiveInt = Field(
description=(
"Maximum Socket.IO / Engine.IO HTTP buffer size in bytes. "
"Large workflow collaboration payloads (sync_request graph snapshots) "
"exceed the Engine.IO default of 1 MiB and get rejected, which "
"disconnects the editor WebSocket. Default is 10 MiB."
),
default=10 * 1024 * 1024,
)
inner_WEB_API_CORS_ALLOW_ORIGINS: str = Field(
description="",
validation_alias=AliasChoices("WEB_API_CORS_ALLOW_ORIGINS"),
+1
View File
@@ -73,5 +73,6 @@ sio = cast(
async_mode="gevent",
client_manager=create_socketio_client_manager(),
cors_allowed_origins=dify_config.CONSOLE_CORS_ALLOW_ORIGINS,
max_http_buffer_size=dify_config.WEBSOCKET_MAX_HTTP_BUFFER_SIZE,
),
)
+1
View File
@@ -55,6 +55,7 @@ OPENDAL_FS_ROOT=storage
# CORS configuration
WEB_API_CORS_ALLOW_ORIGINS=http://127.0.0.1:3000,*
CONSOLE_CORS_ALLOW_ORIGINS=http://127.0.0.1:3000,*
WEBSOCKET_MAX_HTTP_BUFFER_SIZE=10485760
# Vector database configuration
# support: weaviate, qdrant, milvus, myscale, relyt, pgvecto_rs, pgvector, pgvector, chroma, opensearch, tidb_vector, couchbase, vikingdb, upstash, lindorm, oceanbase, iris
@@ -3,6 +3,7 @@ import ssl
import pytest
import socketio
from configs import dify_config
from extensions import ext_socketio
@@ -44,3 +45,7 @@ def test_build_redis_options_omits_socket_timeout(monkeypatch: pytest.MonkeyPatc
assert "socket_timeout" not in options
assert "socket_connect_timeout" in options
def test_socketio_server_uses_configured_max_http_buffer_size() -> None:
assert ext_socketio.sio.eio.max_http_buffer_size == dify_config.WEBSOCKET_MAX_HTTP_BUFFER_SIZE
@@ -319,6 +319,7 @@ CELERY_SENTINEL_MASTER_NAME=
CELERY_SENTINEL_SOCKET_TIMEOUT=0.1
WEB_API_CORS_ALLOW_ORIGINS=*
CONSOLE_CORS_ALLOW_ORIGINS=*
WEBSOCKET_MAX_HTTP_BUFFER_SIZE=10485760
COOKIE_DOMAIN=
OPENDAL_SCHEME=fs
OPENDAL_FS_ROOT=storage