From 6fe1ba2b424550e2821e1c62612912effbe69488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Tue, 14 Jul 2026 13:21:31 +0400 Subject: [PATCH] =?UTF-8?q?fix:=20Connection:=20close=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=B2=D1=81=D0=B5=D1=85=20=D0=BE=D1=82=D0=B2=D0=B5=D1=82=D0=B0?= =?UTF-8?q?=D1=85=20=E2=80=94=20nginx=20=D0=BD=D0=B5=20=D0=BA=D1=8D=D1=88?= =?UTF-8?q?=D0=B8=D1=80=D1=83=D0=B5=D1=82=20upstream=20keepalive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/app.py | 5 +++-- site/routes/api_bp.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) 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"} )