Skip to content

Commit 0aebdd5

Browse files
committed
refac
1 parent 261aec8 commit 0aebdd5

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

backend/dev.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export CORS_ALLOW_ORIGIN="http://localhost:5173;http://localhost:8080"
22
PORT="${PORT:-8080}"
3-
uvicorn open_webui.main:app --port $PORT --host 0.0.0.0 --forwarded-allow-ips '*' --reload
3+
uvicorn open_webui.main:app --port $PORT --host 0.0.0.0 --forwarded-allow-ips "${FORWARDED_ALLOW_IPS:-*}" --reload

backend/start.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ if [ -n "$SPACE_ID" ]; then
5050
echo "Configuring for HuggingFace Space deployment"
5151
if [ -n "$ADMIN_USER_EMAIL" ] && [ -n "$ADMIN_USER_PASSWORD" ]; then
5252
echo "Admin user configured, creating"
53-
WEBUI_SECRET_KEY="$WEBUI_SECRET_KEY" uvicorn open_webui.main:app --host "$HOST" --port "$PORT" --forwarded-allow-ips '*' &
53+
WEBUI_SECRET_KEY="$WEBUI_SECRET_KEY" uvicorn open_webui.main:app --host "$HOST" --port "$PORT" --forwarded-allow-ips "${FORWARDED_ALLOW_IPS:-*}" &
5454
webui_pid=$!
5555
echo "Waiting for webui to start..."
5656
while ! curl -s "http://localhost:${PORT}/health" > /dev/null; do
@@ -83,5 +83,5 @@ fi
8383
WEBUI_SECRET_KEY="$WEBUI_SECRET_KEY" exec "$PYTHON_CMD" -m uvicorn open_webui.main:app \
8484
--host "$HOST" \
8585
--port "$PORT" \
86-
--forwarded-allow-ips '*' \
86+
--forwarded-allow-ips "${FORWARDED_ALLOW_IPS:-*}" \
8787
"${ARGS[@]}"

backend/start_windows.bat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ IF NOT "%WEBUI_SECRET_KEY_FILE%" == "" (
2424

2525
IF "%PORT%"=="" SET PORT=8080
2626
IF "%HOST%"=="" SET HOST=0.0.0.0
27+
IF "%FORWARDED_ALLOW_IPS%"=="" SET "FORWARDED_ALLOW_IPS=*"
2728
SET "WEBUI_SECRET_KEY=%WEBUI_SECRET_KEY%"
2829
SET "WEBUI_JWT_SECRET_KEY=%WEBUI_JWT_SECRET_KEY%"
2930

@@ -46,5 +47,5 @@ IF "%WEBUI_SECRET_KEY% %WEBUI_JWT_SECRET_KEY%" == " " (
4647
:: Execute uvicorn
4748
SET "WEBUI_SECRET_KEY=%WEBUI_SECRET_KEY%"
4849
IF "%UVICORN_WORKERS%"=="" SET UVICORN_WORKERS=1
49-
uvicorn open_webui.main:app --host "%HOST%" --port "%PORT%" --forwarded-allow-ips '*' --workers %UVICORN_WORKERS% --ws auto
50+
uvicorn open_webui.main:app --host "%HOST%" --port "%PORT%" --forwarded-allow-ips "%FORWARDED_ALLOW_IPS%" --workers %UVICORN_WORKERS% --ws auto
5051
:: For ssl user uvicorn open_webui.main:app --host "%HOST%" --port "%PORT%" --forwarded-allow-ips '*' --ssl-keyfile "key.pem" --ssl-certfile "cert.pem" --ws auto

0 commit comments

Comments
 (0)