The Fix
Adds support for the ALPN extension in the aiohttp client SSL context, enabling better compatibility with servers that require this extension.
Based on closed aio-libs/aiohttp issue #10152 · 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,3 @@
@@ -0,0 +1,3 @@
+Enabled ALPN on default SSL contexts. This improves compatibility with some
+proxies which don't work without this extension.
+-- by :user:`Cycloctane`.
Option A — Apply the official fix\nAdds support for the ALPN extension in the aiohttp client SSL context, enabling better compatibility with servers that require this extension.\nWhen NOT to use: This fix should not be used if the server does not require ALPN.\n\n
Why This Fix Works in Production
- Trigger: aiohttp client doesn't send ALPN (TLS application_layer_protocol_negotiation extension). Some servers may refuse to do handshake with clients or block requests…
- Mechanism: aiohttp client does not send ALPN, causing handshake failures with some servers
- 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
- aiohttp client does not send ALPN, causing handshake failures with some servers
- Production symptom (often without a traceback): aiohttp client doesn't send ALPN (TLS application_layer_protocol_negotiation extension). Some servers may refuse to do handshake with clients or block requests without this extension set in TLS layer. (As in #8478 , #10141 )
Proof / Evidence
- GitHub issue: #10152
- Fix PR: https://github.com/aio-libs/aiohttp/pull/10156
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.80
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.69
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“### Is your feature request related to a problem? aiohttp client doesn't send ALPN (TLS application_layer_protocol_negotiation extension). Some servers may refuse to do handshake with clients or block requests without this extension set in”
Failure Signature (Search String)
- aiohttp client doesn't send ALPN (TLS application_layer_protocol_negotiation extension). Some servers may refuse to do handshake with clients or block requests without this
- aiohttp client only uses http/1.1 protocol for now. Simply setting it by `set_alpn_protocols['http/1.1']` after creating SSL default context should be fine.
Copy-friendly signature
Failure Signature
-----------------
aiohttp client doesn't send ALPN (TLS application_layer_protocol_negotiation extension). Some servers may refuse to do handshake with clients or block requests without this extension set in TLS layer. (As in #8478 , #10141 )
aiohttp client only uses http/1.1 protocol for now. Simply setting it by `set_alpn_protocols['http/1.1']` after creating SSL default context should be fine.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
aiohttp client doesn't send ALPN (TLS application_layer_protocol_negotiation extension). Some servers may refuse to do handshake with clients or block requests without this extension set in TLS layer. (As in #8478 , #10141 )
aiohttp client only uses http/1.1 protocol for now. Simply setting it by `set_alpn_protocols['http/1.1']` after creating SSL default context should be fine.
What Broke
Some servers may refuse handshake or block requests without ALPN set in TLS.
Why It Broke
aiohttp client does not send ALPN, causing handshake failures with some servers
Fix Options (Details)
Option A — Apply the official fix
Adds support for the ALPN extension in the aiohttp client SSL context, enabling better compatibility with servers that require this extension.
Fix reference: https://github.com/aio-libs/aiohttp/pull/10156
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the server does not require ALPN.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Add a TLS smoke test that performs a real handshake in CI (include CA bundle validation and hostname checks).
- Alert on handshake failures by error string and endpoint to catch cert/CA changes quickly.
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.