diff --git a/site/app.py b/site/app.py index d9d87df..fda705e 100644 --- a/site/app.py +++ b/site/app.py @@ -20,7 +20,7 @@ if _sys_path_root not in sys.path: sys.path.insert(0, _sys_path_root) # Версия приложения (меняется при изменениях) -VERSION = "0.0.20" +VERSION = "0.0.21" def create_app(): @@ -45,12 +45,13 @@ def create_app(): register_routes(app) - # Запрещаем кэширование — F5 всегда грузит свежую страницу + # Запрещаем кэширование и keep-alive — F5 всегда чистое соединение @app.after_request def no_cache(response): response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" response.headers["Pragma"] = "no-cache" response.headers["Expires"] = "0" + response.headers["Connection"] = "close" return response return app diff --git a/site/routes/api_bp.py b/site/routes/api_bp.py index 7194d7f..86c18d9 100644 --- a/site/routes/api_bp.py +++ b/site/routes/api_bp.py @@ -93,7 +93,7 @@ def process_stream(sid): return Response( stream_with_context(generate()), content_type="text/event-stream", - headers={"Cache-Control": "no-cache", "X-Accel-Buffering": "no"} + headers={"Cache-Control": "no-cache", "X-Accel-Buffering": "no", "Connection": "close"} )