INNER CODE UNIT · Python

global_rate_limit_middleware

KatrielMoses/voidaccess · api/main.py:395

async def global_rate_limit_middleware(request: Request, call_next: Callable):
    if limiter is None:
        return await call_next(request)

    exempt_paths = {"/health", "/docs", "/redoc", "/openapi.json"}
    if request.url.path in exempt_paths:
        return await call_next(request)

    if request.url.path.startswith("/api/") or request.url.path in exempt_paths:
        pass
    else:
        return await call_next(request)

    # Removed invalid limiter.check call causing 500 error
    # Rate limiting should be handled via decorators on specific routes
    pass

    return await call_next(request)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…