Skip to content

Commit 8e9b636

Browse files
committed
Comment out middleware temporarily
1 parent e89fee1 commit 8e9b636

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

src/fides/api/app_setup.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,24 @@ def create_fides_app(
9393
fastapi_app.state.limiter = fides_limiter
9494
# Starlette bug causing this to fail mypy
9595
fastapi_app.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler) # type: ignore
96-
fastapi_app.add_middleware(SecurityHeadersMiddleware)
96+
# fastapi_app.add_middleware(SecurityHeadersMiddleware)
9797
for handler in ExceptionHandlers.get_handlers():
9898
# Starlette bug causing this to fail mypy
9999
fastapi_app.add_exception_handler(RedisNotConfigured, handler) # type: ignore
100100

101-
if is_rate_limit_enabled:
102-
# Validate header before SlowAPI processes the request
103-
fastapi_app.add_middleware(RateLimitIPValidationMiddleware)
104-
# Required for default rate limiting to work
105-
fastapi_app.add_middleware(SlowAPIMiddleware)
106-
else:
107-
logger.warning(
108-
"Rate limiting client IPs is disabled because the FIDES__SECURITY__RATE_LIMIT_CLIENT_IP_HEADER env var is not configured."
109-
)
110-
111-
fastapi_app.add_middleware(
112-
GZipMiddleware, minimum_size=1000, compresslevel=5
113-
) # minimum_size is in bytes
101+
# if is_rate_limit_enabled:
102+
# # Validate header before SlowAPI processes the request
103+
# fastapi_app.add_middleware(RateLimitIPValidationMiddleware)
104+
# # Required for default rate limiting to work
105+
# fastapi_app.add_middleware(SlowAPIMiddleware)
106+
# else:
107+
# logger.warning(
108+
# "Rate limiting client IPs is disabled because the FIDES__SECURITY__RATE_LIMIT_CLIENT_IP_HEADER env var is not configured."
109+
# )
110+
111+
# fastapi_app.add_middleware(
112+
# GZipMiddleware, minimum_size=1000, compresslevel=5
113+
# ) # minimum_size is in bytes
114114

115115
for router in routers:
116116
fastapi_app.include_router(router)

src/fides/api/main.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ async def lifespan(wrapped_app: FastAPI) -> AsyncGenerator[None, None]:
135135

136136

137137
if CONFIG.dev_mode:
138-
139-
@app.middleware("http")
138+
# @app.middleware("http")
140139
async def profile_request(request: Request, call_next: Callable) -> Response:
141140
profiling = request.headers.get("profile-request", False)
142141
if profiling:
@@ -150,7 +149,7 @@ async def profile_request(request: Request, call_next: Callable) -> Response:
150149
return await call_next(request)
151150

152151

153-
@app.middleware("http")
152+
# @app.middleware("http")
154153
async def dispatch_log_request(request: Request, call_next: Callable) -> Response:
155154
"""
156155
HTTP Middleware that logs analytics events for each call to Fides endpoints.
@@ -229,7 +228,7 @@ async def prepare_and_log_request(
229228
)
230229

231230

232-
@app.middleware("http")
231+
# @app.middleware("http")
233232
async def log_request(request: Request, call_next: Callable) -> Response:
234233
"""Log basic information about every request handled by the server."""
235234
start = datetime.now()
@@ -360,7 +359,7 @@ def start_webserver(port: int = 8080) -> None:
360359
server.run()
361360

362361

363-
@app.middleware("http")
362+
# @app.middleware("http")
364363
async def action_to_audit_log(
365364
request: Request,
366365
call_next: Callable,

0 commit comments

Comments
 (0)