fix: CORS configuration for both docker-compose and start_server.sh deployments
- Update start_server.sh to auto-detect local IP and export ALLOWED_ORIGINS - Includes both localhost and detected IP on HTTP/HTTPS proxy ports - Export JWT_SECRET_KEY with ephemeral key if not set - Fix Romanian comments in docker-compose.yml to English - Document two deployment methods in SESSION_STATE.md
This commit is contained in:
@@ -25,8 +25,13 @@ source .venv/bin/activate
|
||||
echo "📦 Updating Python dependencies..."
|
||||
pip install -q -r backend/requirements.txt
|
||||
|
||||
# 4. Start Backend (Python/FastAPI)
|
||||
# 4. Get Local IP and set CORS origins
|
||||
LOCAL_IP=$(ipconfig getifaddr en0 || ipconfig getifaddr en1 || echo "localhost")
|
||||
export ALLOWED_ORIGINS="http://localhost:$FRONTEND_PORT,http://localhost:$BACKEND_PORT,https://localhost:$FRONTEND_SSL_PORT,https://localhost:$BACKEND_SSL_PORT,https://$LOCAL_IP:$FRONTEND_SSL_PORT,https://$LOCAL_IP:$BACKEND_SSL_PORT"
|
||||
export JWT_SECRET_KEY="${JWT_SECRET_KEY:-ephemeral-dev-key-$(date +%s)}"
|
||||
|
||||
echo "🔥 Starting Backend on port $BACKEND_PORT..."
|
||||
echo " CORS origins: $ALLOWED_ORIGINS"
|
||||
python3 -m uvicorn backend.main:app --host 0.0.0.0 --port $BACKEND_PORT --reload &
|
||||
|
||||
# 5. Start Frontend (Next.js)
|
||||
@@ -39,11 +44,7 @@ cd ..
|
||||
npx local-ssl-proxy --source $BACKEND_SSL_PORT --target $BACKEND_PORT --hostname 0.0.0.0 > /dev/null 2>&1 &
|
||||
npx local-ssl-proxy --source $FRONTEND_SSL_PORT --target $FRONTEND_PORT --hostname 0.0.0.0 > /dev/null 2>&1 &
|
||||
|
||||
# 7. Get Local IP
|
||||
LOCAL_IP=$(ipconfig getifaddr en0 || ipconfig getifaddr en1 || echo "<YOUR-IP>")
|
||||
|
||||
# 8. Printing Unified Access Banner
|
||||
LOCAL_IP=$(ipconfig getifaddr en0 || ipconfig getifaddr en1 || echo "<YOUR-IP>")
|
||||
# 7. Print Unified Access Banner
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
|
||||
Reference in New Issue
Block a user