You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Cloud Run服务Flutter客户端TLS握手错误求助

Flutter客户端调用Google Cloud Run Node.js API时出现TLS握手错误

报错信息

Unhandled Exception: HandshakeException: Handshake error in client (OS Error: WRONG_VERSION_NUMBER(tls_record.cc:242))

调用代码

static Future<http.Response> get(String url, {Map<String, String>? headers}) async {
    final _headers = await _addAuthHeader(headers); // 追加认证头(当前未启用)
    final out = await http.get(Uri.parse(url), headers: _headers); // 此处抛出异常
    return out;
}

环境与测试情况

Google Cloud Run仅配置“允许未认证调用”,使用托管TLS服务,经多场景测试结果如下:

  • curl https://<url> 正常 ✅
  • curl --tls-max 1.2 https://<url> 正常 ✅
  • curl --tls-max 1.1 https://<url> 失败 ❌
  • Dart使用dio包发起HTTPS调用失败 ❌
  • Dart使用http包发起HTTPS调用失败 ❌
  • Dart发起HTTP调用正常 ✅
  • Chrome浏览器访问正常 ✅

系统信息

  • Flutter版本:3.3.8
  • Dart版本:2.18.4
  • Flutter doctor检测结果:全部正常

已尝试Stack Overflow相关解决方案,但问题未解决。

内容的提问来源于stack exchange,提问作者Leonardo Pivetta

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.11 13:40:25