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=["احراز هویت"])