From 27a9a82a3717ad88cbb46bcd48f17643b155127a Mon Sep 17 00:00:00 2001 From: aramesh-site deploy Date: Tue, 6 Oct 2026 12:26:02 +0000 Subject: [PATCH] =?UTF-8?q?fix(api):=20Cache-Control=20no-store=20=D8=B1?= =?UTF-8?q?=D9=88=DB=8C=20=D9=87=D9=85=D9=87=D9=94=20=D9=BE=D8=A7=D8=B3?= =?UTF-8?q?=D8=AE=E2=80=8C=D9=87=D8=A7=DB=8C=20API=20=E2=80=94=20=D8=AF?= =?UTF-8?q?=D8=A7=D8=AF=D9=87=D9=94=20=DA=A9=D9=87=D9=86=D9=87=D9=94=20?= =?UTF-8?q?=D9=85=D8=B1=D9=88=D8=B1=DA=AF=D8=B1=20=D8=B9=D9=84=D8=AA=20?= =?UTF-8?q?=D8=AF=DB=8C=D8=AF=D9=86=20=D9=86=D8=B3=D8=AE=D9=87=D9=94=20?= =?UTF-8?q?=D9=82=D8=AF=DB=8C=D9=85=DB=8C=20=D9=85=D9=82=D8=A7=D9=84=D9=87?= =?UTF-8?q?=E2=80=8C=D9=87=D8=A7=20=D8=A8=D9=88=D8=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/app/main.py b/backend/app/main.py index 1ee7237..2f024cf 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -45,6 +45,14 @@ async def _preview_noindex(request, call_next): response.headers["X-Robots-Tag"] = "noindex, nofollow, noarchive" return response +# پاسخ‌های API هرگز کش مرورگر/CDN نشوند — دادهٔ پنل بعد از هر ذخیره فوراً fresh بماند +@app.middleware("http") +async def _api_no_store(request, call_next): + response = await call_next(request) + if request.url.path.startswith("/api"): + response.headers["Cache-Control"] = "no-store" + return response + app.include_router(public.router, prefix="/api", tags=["عمومی"]) app.include_router(forms.router, prefix="/api", tags=["فرم‌ها"]) app.include_router(admin.auth_router, prefix="/api", tags=["احراز هویت"])