fix: bypass rate limiting for internal network IPs (10.1.223.93, 10.1.223.40)
This commit is contained in:
@@ -32,8 +32,8 @@ class RateLimitMiddleware(BaseHTTPMiddleware):
|
|||||||
|
|
||||||
async def dispatch(self, request: Request, call_next):
|
async def dispatch(self, request: Request, call_next):
|
||||||
client_ip = request.client.host if request.client else "unknown"
|
client_ip = request.client.host if request.client else "unknown"
|
||||||
# Bypass rate limiting for localhost (sync/health internal traffic)
|
# Bypass rate limiting for localhost and internal network (sync/health internal traffic)
|
||||||
if client_ip in {"127.0.0.1", "::1"}:
|
if client_ip in {"127.0.0.1", "::1", "10.1.223.93", "10.1.223.40"}:
|
||||||
return await call_next(request)
|
return await call_next(request)
|
||||||
now = time.time()
|
now = time.time()
|
||||||
# Clean old entries
|
# Clean old entries
|
||||||
|
|||||||
Reference in New Issue
Block a user