From 02a7d3c228f3993096ea0d3f736e078c4975c639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E6=AD=A3=E8=B6=85?= Date: Sat, 23 May 2026 12:52:46 +0800 Subject: [PATCH] fix: derive run script CORS console port (#3068) --- scripts/run.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/run.sh b/scripts/run.sh index 4d4e996db..4e798ada2 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -66,7 +66,11 @@ export RUSTFS_REGION="${RUSTFS_REGION:-us-east-1}" export RUSTFS_CONSOLE_ENABLE="${RUSTFS_CONSOLE_ENABLE:-true}" export RUSTFS_CONSOLE_ADDRESS="${RUSTFS_CONSOLE_ADDRESS:-127.0.0.1:9001}" if [ -z "${RUSTFS_CORS_ALLOWED_ORIGINS+x}" ]; then - export RUSTFS_CORS_ALLOWED_ORIGINS="http://127.0.0.1:9001,http://localhost:9001,http://127.0.0.1:3000,http://localhost:3000" + console_port="${RUSTFS_CONSOLE_ADDRESS##*:}" + if [ -z "$console_port" ] || [ "$console_port" = "$RUSTFS_CONSOLE_ADDRESS" ]; then + console_port=9001 + fi + export RUSTFS_CORS_ALLOWED_ORIGINS="http://127.0.0.1:${console_port},http://localhost:${console_port},http://127.0.0.1:3000,http://localhost:3000" fi # export RUSTFS_SERVER_DOMAINS="localhost:9000" # HTTPS certificate directory