mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 18:42:34 +01:00
Merge pull request #999 from adamantike/misc/enable-gzip-compression
misc: Enable GZip compression for backend responses
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user