解决:http: TLS handshake error from *

简介: 今天以容器的形式在公网上一个部署了一个云服务,在测试环境是没有问题的,不知道为什么部署到 beta 环境就出现了问题,导致 https 协议文件访问失败。

目录

  • 问题
  • 解决
  • 结尾

问题

今天以容器的形式在公网上一个部署了一个云服务,在测试环境是没有问题的,不知道为什么部署到 beta 环境就出现了问题,导致 https 协议文件访问失败。

具体报错信息如下:

2021/11/09 07:15:58 http: TLS handshake error from 125.64.94.138:34428: remote error: tls: bad certificate\
2021/11/09 07:15:58 http: TLS handshake error from 125.64.94.138:36510: EOF\
2021/11/09 07:15:58 http: TLS handshake error from 125.64.94.138:39042: read tcp 172.17.0.79:9443->125.64.94.138:39042: read: connection reset by peer\
2021/11/09 07:15:58 http: TLS handshake error from 125.64.94.138:41490: EOF\
2021/11/09 07:15:58 http: TLS handshake error from 125.64.94.138:42006: read tcp 172.17.0.79:9443->125.64.94.138:42006: read: connection reset by peer\
2021/11/09 07:16:00 http: TLS handshake error from 125.64.94.138:42738: read tcp 172.17.0.79:9443->125.64.94.138:42738: read: connection reset by peer\
2021/11/09 07:16:01 http: TLS handshake error from 125.64.94.138:51154: read tcp 172.17.0.79:9443->125.64.94.138:51154: read: connection reset by peer\
2021/11/09 07:16:01 http: TLS handshake error from 125.64.94.138:33806: read tcp 172.17.0.79:9443->125.64.94.138:33806: read: connection reset by peer\
2021/11/09 07:16:01 http: TLS handshake error from 125.64.94.138:34836: read tcp 172.17.0.79:9443->125.64.94.138:34836: read: connection reset by peer\
2021/11/09 07:16:01 http: TLS handshake error from 125.64.94.138:35318: read tcp 172.17.0.79:9443->125.64.94.138:35318: read: connection reset by peer\
2021/11/09 07:16:16 http: TLS handshake error from 125.64.94.138:34338: read tcp 172.17.0.79:9443->125.64.94.138:34338: read: connection reset by peer\
2021/11/09 11:24:42 http: TLS handshake error from 209.17.97.114:65306: EOF\
2021/11/09 13:46:06 http: TLS handshake error from 89.248.174.193:39762: EOF\
2021/11/09 15:51:50 http: TLS handshake error from 165.227.163.245:38494: EOF

通过报错信息,大致猜测可能是证书原因导致的握手失败,具体原因还不是很清楚,至少是一个分析和思考的方向。

进一步分析报错日志,可以发现握手过程中,IP 地址为 125.64.94.138 的机器不断尝试切换其他端口,但是每次都被重置连接,最终导致连接失败。

解决

网上搜索了很多资料,但是介绍的方法都没有解决自己遇到的问题,后来在梳理整体流程的时候发现了原因。因为容器服务本身同时支持 http 协议和 https 协议,有一层 https 证书,在测试环境中没有问题,但是 beta 环境中所有服务访问的入口都要经过 Nginx 代理服务转发请求,而 Nginx 服务本身又设置了一层 https 证书,二层证书不一致导致了错误的发生。

因此,解决方法有两种,一是仅使用一层 https 证书;二是统一两层证书,使用相同的签名证书。

结尾

有时候,很多问题在自测的时候很难发现,是因为没有放到具体的生产环境中去,因此,开发过程中一定要考虑到未来部署后可能出现的问题,编码时尽量规避。



作者简介:大家好,我是 liuzhen007,是一位音视频技术爱好者,同时也是CSDN博客专家、华为云享专家、InfoQ 签约作者,欢迎关注我分享更多干货!


目录
相关文章
|
4月前
|
机器学习/深度学习 前端开发 JavaScript
源映射错误:Error: request failed with status 404 源 URL:http://localhost:8080/bootstrap/js/axios-0.18.0.js
源映射错误:Error: request failed with status 404 源 URL:http://localhost:8080/bootstrap/js/axios-0.18.0.js
118 0
源映射错误:Error: request failed with status 404 源 URL:http://localhost:8080/bootstrap/js/axios-0.18.0.js
|
1月前
|
Web App开发 监控 UED
如何解决Angular中的Error: HTTP request failed, call timeout问题
在Angular应用中,遇到HTTP请求超时错误`Error: HTTP request failed, call timeout`时,可通过多种途径解决。首先,可增加请求超时时间,Angular默认无超时限制,设置合理的超时时间如5秒有助于避免长时间等待无响应。其次,检查服务器响应时间,利用开发者工具监控网络请求,优化服务器端代码或调整超时值。最后,确认网络连接稳定性,使用`navigator.onLine`检测网络状态,并在不同网络环境中测试。这些策略共同作用,能够有效提升应用的稳定性和用户体验。
102 1
|
1月前
|
传感器 机器学习/深度学习
如何下载DVS Gesture数据集?解决tonic.datasets.DVSGesture错误HTTP Error 403: Forbidden
本文介绍了如何解决在使用tonic库下载DVSGesture数据集时遇到的HTTP Error 403 Forbidden错误,建议从Figshare的链接下载完整数据集并解压到指定目录,以便成功加载数据集进行手势识别研究。
44 1
|
2月前
|
缓存 网络协议 算法
(二)Java网络编程之爆肝HTTP、HTTPS、TLS协议及对称与非对称加密原理!
作为一名程序员,尤其是Java程序员,那必须得了解并掌握HTTP/HTTPS相关知识。因为在如今计算机网络通信中,HTTP协议的作用功不可没,无论是日常上网追剧、冲���、亦或是接口开发、调用等,必然存在HTTP的“影子”在内。尤其对于WEB开发者而言,HTTP几乎是每天会打交道的东西。
68 10
|
1月前
|
Python
【Azure 应用服务】Azure Function HTTP Trigger 遇见奇妙的500 Internal Server Error: Failed to forward request to http://169.254.130.x
【Azure 应用服务】Azure Function HTTP Trigger 遇见奇妙的500 Internal Server Error: Failed to forward request to http://169.254.130.x
|
2月前
|
API Python
【Python】已解决:urllib.error.HTTPError: HTTP Error 403: Forbidden
【Python】已解决:urllib.error.HTTPError: HTTP Error 403: Forbidden
595 1
|
3月前
|
开发工具 git
出现“error: failed to push some refs to ‘https://github.com/****.git‘”,如何解决问题
出现“error: failed to push some refs to ‘https://github.com/****.git‘”,如何解决问题
218 1
Get “https://npm.taobao.org/mirrors/node/latest/SHASUMS256.txt“: tls: failed to verify certificate:
Get “https://npm.taobao.org/mirrors/node/latest/SHASUMS256.txt“: tls: failed to verify certificate:
|
3月前
|
Kubernetes 容器 Perl
k8s部署seata 报错 没有提供足够的身份验证信息 [ http-nio-7091-exec-2] [ty.JwtAuthenticationEntryPoint] [ commence] [] : Responding with unauthorized error. Message - Full authentication is required to access this resource
Kubernetes pod 在16:12时出现两次错误,错误信息显示需要完整认证才能访问资源。尽管有此错误,但页面可正常访问。附有yaml配置文件的图片。
322 2
|
4月前
|
开发框架 .NET 数据库连接
解决HTTP错误500.19 - internal server error -内部服务器错误的终极指南
解决HTTP错误500.19 - internal server error -内部服务器错误的终极指南
2455 0