mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
fix: Socket.IO CORS warning
Co-Authored-By: Gero Doll <6284675+limbicnation@users.noreply.github.com>
This commit is contained in:
parent
7faf19dad9
commit
639d26252e
1 changed files with 5 additions and 2 deletions
|
|
@ -53,6 +53,9 @@ log.setLevel(SRC_LOG_LEVELS["SOCKET"])
|
||||||
|
|
||||||
REDIS = None
|
REDIS = None
|
||||||
|
|
||||||
|
# Configure CORS for Socket.IO
|
||||||
|
SOCKETIO_CORS_ORIGINS = "*" if CORS_ALLOW_ORIGIN == ["*"] else CORS_ALLOW_ORIGIN
|
||||||
|
|
||||||
if WEBSOCKET_MANAGER == "redis":
|
if WEBSOCKET_MANAGER == "redis":
|
||||||
if WEBSOCKET_SENTINEL_HOSTS:
|
if WEBSOCKET_SENTINEL_HOSTS:
|
||||||
mgr = socketio.AsyncRedisManager(
|
mgr = socketio.AsyncRedisManager(
|
||||||
|
|
@ -63,7 +66,7 @@ if WEBSOCKET_MANAGER == "redis":
|
||||||
else:
|
else:
|
||||||
mgr = socketio.AsyncRedisManager(WEBSOCKET_REDIS_URL)
|
mgr = socketio.AsyncRedisManager(WEBSOCKET_REDIS_URL)
|
||||||
sio = socketio.AsyncServer(
|
sio = socketio.AsyncServer(
|
||||||
cors_allowed_origins=CORS_ALLOW_ORIGIN,
|
cors_allowed_origins=SOCKETIO_CORS_ORIGINS,
|
||||||
async_mode="asgi",
|
async_mode="asgi",
|
||||||
transports=(["websocket"] if ENABLE_WEBSOCKET_SUPPORT else ["polling"]),
|
transports=(["websocket"] if ENABLE_WEBSOCKET_SUPPORT else ["polling"]),
|
||||||
allow_upgrades=ENABLE_WEBSOCKET_SUPPORT,
|
allow_upgrades=ENABLE_WEBSOCKET_SUPPORT,
|
||||||
|
|
@ -72,7 +75,7 @@ if WEBSOCKET_MANAGER == "redis":
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
sio = socketio.AsyncServer(
|
sio = socketio.AsyncServer(
|
||||||
cors_allowed_origins=CORS_ALLOW_ORIGIN,
|
cors_allowed_origins=SOCKETIO_CORS_ORIGINS,
|
||||||
async_mode="asgi",
|
async_mode="asgi",
|
||||||
transports=(["websocket"] if ENABLE_WEBSOCKET_SUPPORT else ["polling"]),
|
transports=(["websocket"] if ENABLE_WEBSOCKET_SUPPORT else ["polling"]),
|
||||||
allow_upgrades=ENABLE_WEBSOCKET_SUPPORT,
|
allow_upgrades=ENABLE_WEBSOCKET_SUPPORT,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue