diff --git a/backend/main.py b/backend/main.py index d8281b0f7..7d1c639a8 100644 --- a/backend/main.py +++ b/backend/main.py @@ -28,6 +28,7 @@ from endpoints import ( ) from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware +from fastapi.middleware.gzip import GZipMiddleware from handler.auth.base_handler import ALGORITHM from handler.auth.hybrid_auth import HybridAuthBackend from handler.auth.middleware import CustomCSRFMiddleware, SessionMiddleware @@ -61,6 +62,9 @@ if "pytest" not in sys.modules and not DISABLE_CSRF_PROTECTION: exempt_urls=[re.compile(r"^/token.*"), re.compile(r"^/ws")], ) +# Enable GZip compression for responses +app.add_middleware(GZipMiddleware, minimum_size=1024) + # Handles both basic and oauth authentication app.add_middleware( AuthenticationMiddleware,