--- id: aiohttp-middlewares version: "2.4.0" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # aiohttp-middlewares — Collection of useful middlewares for aiohttp applications. License: permissive · Maintenance: active · Downloads: 198.5K/mo ## What it is and what it does aiohttp-middlewares is a curated collection of middleware functions designed to fill gaps in aiohttp.web's built-in middleware offerings. It addresses common web-development patterns—CORS header injection, centralized error handling, request shielding—that developers would otherwise implement themselves. The package works as a drop-in set of middleware factories that you pass to aiohttp's Application constructor. The package depends on aiohttp, async-timeout, and yarl, all standard async-web components. It is actively maintained, supports Python 3.8 through 3.12, and carries no known security vulnerabilities. The BSD-3-Clause license permits use in any project type. Use it for: - Enable CORS headers for cross-origin requests in a single middleware registration. - Centralize error handling and HTTP exception responses across all routes. - Shield view handlers from cancellation during request processing. - Add request/response logging or timing middleware to an aiohttp application. - Implement common security headers or request validation patterns without custom code. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a collection of ready-to-use middlewares for aiohttp.web applications, covering common needs like CORS headers, error handling, and request shielding. Yes. Active maintenance, no vulnerabilities, low install friction, and a permissive license make this a safe choice. Install it if you are building an aiohttp.web application and want to avoid writing standard middleware boilerplate for CORS, error handling, or similar cross-cutting concerns. ## Install pip install aiohttp-middlewares uv add aiohttp-middlewares poetry add aiohttp-middlewares ## Installing aiohttp-middlewares Before you install: Low install friction with a pure-Python wheel. Active maintenance with a recent commit on 2026-03-30 and stable production status. License in practice: BSD-3-Clause is permissive; you can use this in commercial and proprietary projects with minimal restrictions, provided you include the license text. Quickstart: pip install aiohttp-middlewares from aiohttp import web from aiohttp_middlewares import cors_middleware, error_middleware app = web.Application( middlewares=( cors_middleware(origins=("http://localhost:8081",)), error_middleware(), ) ) Requires aiohttp 3.8.1 or later and Python 3.8+. Verify before relying: - Whether all advertised middlewares are documented and which ones are most commonly used in production. - Performance characteristics when stacking multiple middlewares on high-traffic applications. ## Package facts - License: BSD-3-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 198.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags aiohttp middleware collection, aiohttp cors middleware, aiohttp error handling, aiohttp web utilities, async web middleware, aiohttp request middleware, aiohttp application middleware, aiohttp, async-web, middleware [View on SkillFed](https://skillfed.io/packages/aiohttp-middlewares) · [View on PyPI](https://pypi.org/project/aiohttp-middlewares/)