Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

fix(backend): auto-allow SERVERKIT_PUBLIC_URL in CORS; bump Flask-SocketIO

Juan Denis6525e66a8310
diff --git a/backend/config.py b/backend/config.py
index 055c99e6..00c5c7a3 100644
--- a/backend/config.py
+++ b/backend/config.py
@@ -35,7 +35,16 @@ class Config:
'http://localhost:5000',
'http://127.0.0.1:5000',
])
- CORS_ORIGINS = os.environ.get('CORS_ORIGINS', DEFAULT_CORS_ORIGINS).split(',')
+ _cors_raw = os.environ.get('CORS_ORIGINS', DEFAULT_CORS_ORIGINS)
+ CORS_ORIGINS = [o.strip() for o in _cors_raw.split(',') if o.strip()]
+ # Whenever the panel sits behind a reverse proxy / tunnel, agents and
+ # browsers come from SERVERKIT_PUBLIC_URL — auto-allow it so the user
+ # only has to configure that public URL in one place. Without this
+ # the engine.io WS handshake rejects the public origin and every
+ # Socket.IO connection 400s with "not an accepted origin".
+ _public_url = os.environ.get('SERVERKIT_PUBLIC_URL', '').strip().rstrip('/')
+ if _public_url and _public_url not in CORS_ORIGINS:
+ CORS_ORIGINS.append(_public_url)
class DevelopmentConfig(Config):
diff --git a/backend/requirements.txt b/backend/requirements.txt
index 149ae82e..491c1d6b 100644
--- a/backend/requirements.txt
+++ b/backend/requirements.txt
@@ -15,7 +15,7 @@ PyJWT==2.12.1
Flask-Cors==6.0.2
# WebSocket support
-Flask-SocketIO==5.4.1
+Flask-SocketIO==5.6.1
python-socketio==5.14.0
python-engineio==4.11.2