Your async proxy fails with HTTPS because after the 200 Connection established response, you're supposed to tunnel encrypted data without touching it. But your code closes sockets too early and doesn’t handle both directions properly. Use asyncio.open_connection()
and forward data both ways until the connection naturally ends