diff --git a/backend/open_webui/routers/functions.py b/backend/open_webui/routers/functions.py index 1d0f0342d..baec1f087 100644 --- a/backend/open_webui/routers/functions.py +++ b/backend/open_webui/routers/functions.py @@ -6,7 +6,7 @@ import aiohttp from pathlib import Path from typing import Optional -from open_webui.env import AIOHTTP_CLIENT_TIMEOUT +from open_webui.env import AIOHTTP_CLIENT_SESSION_SSL, AIOHTTP_CLIENT_TIMEOUT from open_webui.models.functions import ( FunctionForm, FunctionModel, @@ -117,7 +117,7 @@ async def load_function_from_url(request: Request, form_data: LoadUrlForm, user= async with aiohttp.ClientSession( trust_env=True, timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT) ) as session: - async with session.get(url, headers={'Content-Type': 'application/json'}) as resp: + async with session.get(url, headers={'Content-Type': 'application/json'}, ssl=AIOHTTP_CLIENT_SESSION_SSL) as resp: if resp.status != 200: raise HTTPException(status_code=resp.status, detail='Failed to fetch the function') data = await resp.text() diff --git a/backend/open_webui/routers/openai.py b/backend/open_webui/routers/openai.py index 82c844afb..8a7c3aca7 100644 --- a/backend/open_webui/routers/openai.py +++ b/backend/open_webui/routers/openai.py @@ -1296,6 +1296,7 @@ async def embeddings(request: Request, form_data: dict, user): headers=headers, cookies=cookies, timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT), + ssl=AIOHTTP_CLIENT_SESSION_SSL, ) if 'text/event-stream' in r.headers.get('Content-Type', ''): diff --git a/backend/open_webui/routers/terminals.py b/backend/open_webui/routers/terminals.py index 0d607d1f7..003db0696 100644 --- a/backend/open_webui/routers/terminals.py +++ b/backend/open_webui/routers/terminals.py @@ -16,6 +16,7 @@ from starlette.background import BackgroundTask from open_webui.utils.auth import get_verified_user from open_webui.utils.access_control import has_connection_access +from open_webui.env import AIOHTTP_CLIENT_SESSION_SSL from open_webui.models.groups import Groups from open_webui.models.users import Users @@ -141,6 +142,7 @@ async def proxy_terminal( headers=headers, cookies=cookies, data=body or None, + ssl=AIOHTTP_CLIENT_SESSION_SSL, ) upstream_content_type = upstream_response.headers.get('content-type', '') @@ -279,7 +281,7 @@ async def ws_terminal( session = aiohttp.ClientSession() try: - async with session.ws_connect(upstream_url) as upstream: + async with session.ws_connect(upstream_url, ssl=AIOHTTP_CLIENT_SESSION_SSL) as upstream: import asyncio import json as _json diff --git a/backend/open_webui/routers/tools.py b/backend/open_webui/routers/tools.py index d70b4038f..4c3e77e56 100644 --- a/backend/open_webui/routers/tools.py +++ b/backend/open_webui/routers/tools.py @@ -4,7 +4,7 @@ from typing import Optional import time import re import aiohttp -from open_webui.env import AIOHTTP_CLIENT_TIMEOUT +from open_webui.env import AIOHTTP_CLIENT_SESSION_SSL, AIOHTTP_CLIENT_TIMEOUT from open_webui.models.groups import Groups from pydantic import BaseModel, HttpUrl from fastapi import APIRouter, Depends, HTTPException, Request, status @@ -274,7 +274,7 @@ async def load_tool_from_url(request: Request, form_data: LoadUrlForm, user=Depe async with aiohttp.ClientSession( trust_env=True, timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT) ) as session: - async with session.get(url, headers={'Content-Type': 'application/json'}) as resp: + async with session.get(url, headers={'Content-Type': 'application/json'}, ssl=AIOHTTP_CLIENT_SESSION_SSL) as resp: if resp.status != 200: raise HTTPException(status_code=resp.status, detail='Failed to fetch the tool') data = await resp.text()