【问题标题】:requests.exceptions.SSLError: hostname 'boxfwd.com' doesn't match either of 'nycmsk.com', 'www.nycmsk.com'requests.exceptions.SSLError:主机名“boxfwd.com”与“nycmsk.com”、“www.nycmsk.com”中的任何一个都不匹配
【发布时间】:2015-09-19 11:10:40
【问题描述】:

python上非常简单的例子:

import requests

c = requests.get(u'https://boxfwd.com').content
print c

在我的本地计算机上一切正常。

但是在服务器上我看到了这个错误:

requests.exceptions.SSLError: hostname 'boxfwd.com' doesn't match either of 'nycmsk.com', 'www.nycmsk.com'

为什么我在服务器上看到这个错误?

在浏览器中,我看到 *.boxfwd.com 的证书

【问题讨论】:

    标签: python ssl https python-requests


    【解决方案1】:

    似乎在您的服务器中还托管了另一个域 (nycmsk.com),requests 获取了该证书。

    在这里寻找潜在的解决方案:https://2.python-requests.org/en/master/community/faq/#what-are-hostname-doesn-t-match-errors

    也可能与以下内容重复:using requests with TLS doesn't give SNI support

    【讨论】:

      【解决方案2】:

      在将 HAProxy 与 Datadog 集成以进行监控时,我遇到了相同类型的错误。 堆栈跟踪: 代理服务器 -------- - 实例 #0 [错误]: '(\'Connection aborted.\', BadStatusLine("\'\'",))' - 收集 0 个指标、0 个事件和 0 个服务检查

      原因是我的 EC2 框 url 可以通过 https 访问,导致启用 ssl。在 data-agent/conf.d/haproxy.yaml 中的 haproxy.yaml 中添加“disable_ssl_validation: true”后,它起作用了

      【讨论】:

        猜你喜欢
        • 2020-08-06
        • 1970-01-01
        • 2017-12-26
        • 2021-05-24
        • 1970-01-01
        • 2015-03-14
        • 2020-02-04
        • 2020-11-22
        相关资源
        最近更新 更多