The Fix
Added a host parameter to the aiohttp_server fixture to allow access from non-local clients, such as those running in Docker containers.
Based on closed aio-libs/aiohttp issue #10120 · PR/commit linked
Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.
@@ -0,0 +1 @@
@@ -0,0 +1 @@
+Added ``host`` parameter to ``aiohttp_server`` fixture -- by :user:`christianwbrock`.
diff --git a/aiohttp/pytest_plugin.py b/aiohttp/pytest_plugin.py
index 8eef2f46d44..1803257cc36 100644
Option A — Apply the official fix\nAdded a host parameter to the aiohttp_server fixture to allow access from non-local clients, such as those running in Docker containers.\nWhen NOT to use: This fix is not suitable if the server must remain accessible only on localhost.\n\n
Why This Fix Works in Production
- Trigger: Change lines 306ff in `aiohttp.pytest_plugin.py` from
- Mechanism: Added a host parameter to the aiohttp_server fixture to allow access from non-local clients, such as those running in Docker containers.
- If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.
Why This Breaks in Prod
- Production symptom (often without a traceback): Change lines 306ff in `aiohttp.pytest_plugin.py` from
Proof / Evidence
- GitHub issue: #10120
- Fix PR: https://github.com/aio-libs/aiohttp/pull/10121
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.70
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.78
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“I think that's reasonable, feel free to make a PR.”
“I created a PR: https://github.com/aio-libs/aiohttp/pull/10121/files”
Failure Signature (Search String)
- Change lines 306ff in `aiohttp.pytest_plugin.py` from
Copy-friendly signature
Failure Signature
-----------------
Change lines 306ff in `aiohttp.pytest_plugin.py` from
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Change lines 306ff in `aiohttp.pytest_plugin.py` from
What Broke
Docker services cannot reach the aiohttp_server, causing failures in callbacks.
Fix Options (Details)
Option A — Apply the official fix
Added a host parameter to the aiohttp_server fixture to allow access from non-local clients, such as those running in Docker containers.
Fix reference: https://github.com/aio-libs/aiohttp/pull/10121
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not suitable if the server must remain accessible only on localhost.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
- Pin production dependencies and upgrade only with a reproducible test that hits the failing path.
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.