HariLogicgo commited on
Commit
b80a82c
·
1 Parent(s): beaf86b

modified app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -130,7 +130,7 @@ async def shutdown_db():
130
  # -------------------------------------------------
131
  # 🔐 Global Auth Middleware
132
  # -------------------------------------------------
133
- PUBLIC_PATHS = ["/", "/health", "/gradio"]
134
 
135
  API_SECRET_TOKEN = os.getenv("API_SECRET_TOKEN")
136
  if not API_SECRET_TOKEN:
@@ -139,7 +139,7 @@ if not API_SECRET_TOKEN:
139
  @fastapi_app.middleware("http")
140
  async def auth_middleware(request: Request, call_next):
141
  path = request.url.path
142
- if any(path.startswith(p) for p in PUBLIC_PATHS):
143
  return await call_next(request)
144
 
145
  auth_header = request.headers.get("Authorization")
 
130
  # -------------------------------------------------
131
  # 🔐 Global Auth Middleware
132
  # -------------------------------------------------
133
+ PUBLIC_PATHS = ["/health"]
134
 
135
  API_SECRET_TOKEN = os.getenv("API_SECRET_TOKEN")
136
  if not API_SECRET_TOKEN:
 
139
  @fastapi_app.middleware("http")
140
  async def auth_middleware(request: Request, call_next):
141
  path = request.url.path
142
+ if path in PUBLIC_PATHS: # exact match
143
  return await call_next(request)
144
 
145
  auth_header = request.headers.get("Authorization")