refac
This commit is contained in:
1 parent
d11e06f1b7
commit
8d3133fe28
2 files changed
+8
No files matched your search
@@ -1226,6 +1226,11 @@ TERMINAL_SERVER_CONNECTIONS = PersistentConfig(
|
|||||||
terminal_server_connections,
|
terminal_server_connections,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
TERMINAL_PROXY_HEADERS = json.loads(os.environ.get('TERMINAL_PROXY_HEADERS', '{}'))
|
||||||
|
except Exception:
|
||||||
|
TERMINAL_PROXY_HEADERS = {}
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# WEBUI
|
# WEBUI
|
||||||
####################################
|
####################################
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ from starlette.background import BackgroundTask
|
|||||||
from open_webui.utils.auth import get_verified_user
|
from open_webui.utils.auth import get_verified_user
|
||||||
from open_webui.utils.access_control import has_connection_access
|
from open_webui.utils.access_control import has_connection_access
|
||||||
from open_webui.env import AIOHTTP_CLIENT_SESSION_SSL
|
from open_webui.env import AIOHTTP_CLIENT_SESSION_SSL
|
||||||
|
from open_webui.config import TERMINAL_PROXY_HEADERS
|
||||||
from open_webui.models.groups import Groups
|
from open_webui.models.groups import Groups
|
||||||
from open_webui.models.users import Users
|
from open_webui.models.users import Users
|
||||||
|
|
||||||
@@ -151,6 +152,8 @@ async def proxy_terminal(
|
|||||||
for key, value in upstream_response.headers.items()
|
for key, value in upstream_response.headers.items()
|
||||||
if key.lower() not in STRIPPED_RESPONSE_HEADERS
|
if key.lower() not in STRIPPED_RESPONSE_HEADERS
|
||||||
}
|
}
|
||||||
|
if TERMINAL_PROXY_HEADERS:
|
||||||
|
filtered_headers.update(TERMINAL_PROXY_HEADERS)
|
||||||
|
|
||||||
# Stream binary responses directly
|
# Stream binary responses directly
|
||||||
if any(t in upstream_content_type for t in STREAMING_CONTENT_TYPES):
|
if any(t in upstream_content_type for t in STREAMING_CONTENT_TYPES):
|
||||||
|
|||||||
Reference in new issue
Block a user