Release v0.1.1 #1

Merged
kqjy merged 20 commits from next into main 2025-11-22 12:31:27 +00:00
3 changed files with 18 additions and 6 deletions
Showing only changes of commit ebef3dfa57 - Show all commits

View File

@@ -25,6 +25,21 @@ from .storage import ObjectStorage
from .version import get_version from .version import get_version
class ServerHeaderMiddleware:
def __init__(self, app, server_name):
self.app = app
self.server_name = server_name
def __call__(self, environ, start_response):
def custom_start_response(status, headers, exc_info=None):
# Remove existing Server header if present
headers = [(name, value) for name, value in headers if name.lower() != 'server']
headers.append(('Server', self.server_name))
return start_response(status, headers, exc_info)
return self.app(environ, custom_start_response)
def create_app( def create_app(
test_config: Optional[Dict[str, Any]] = None, test_config: Optional[Dict[str, Any]] = None,
*, *,
@@ -50,6 +65,7 @@ def create_app(
# Trust X-Forwarded-* headers from proxies # Trust X-Forwarded-* headers from proxies
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1) app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1)
app.wsgi_app = ServerHeaderMiddleware(app.wsgi_app, "MyFSIO")
_configure_cors(app) _configure_cors(app)
_configure_logging(app) _configure_logging(app)
@@ -215,5 +231,4 @@ def _configure_logging(app: Flask) -> None:
}, },
) )
response.headers["X-Request-Duration-ms"] = f"{duration_ms:.2f}" response.headers["X-Request-Duration-ms"] = f"{duration_ms:.2f}"
response.headers["Server"] = "MyFSIO"
return response return response

View File

@@ -2,7 +2,7 @@
set -e set -e
# Start API server in background # Start API server in background
gunicorn "app:create_api_app()" -c gunicorn.conf.py --bind 0.0.0.0:5000 --workers 4 --access-logfile - & gunicorn "app:create_api_app()" --bind 0.0.0.0:5000 --workers 4 --access-logfile - &
# Start UI server in foreground # Start UI server in foreground
gunicorn "app:create_ui_app()" -c gunicorn.conf.py --bind 0.0.0.0:5100 --workers 4 --access-logfile - gunicorn "app:create_ui_app()" --bind 0.0.0.0:5100 --workers 4 --access-logfile -

View File

@@ -1,3 +0,0 @@
import gunicorn
gunicorn.SERVER = 'MyFSIO'