dhythhsba
dhythhsba

Reputation: 1032

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

Very simple example on python:

import requests

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

And on my local computer all works fine.

But on server I see this error:

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

Why I see this error on server ?

In browser I see certificate to *.boxfwd.com certificate

Upvotes: 6

Views: 12648

Answers (2)

miltos
miltos

Reputation: 89

It seems that in your server another domain (nycmsk.com) is also hosted and requests picks up that certificate.

Look here for a potential solution: https://2.python-requests.org/en/master/community/faq/#what-are-hostname-doesn-t-match-errors

Also probably duplicate with: using requests with TLS doesn't give SNI support

Upvotes: 1

Afsar
Afsar

Reputation: 89

Same type of error I was getting while integrating my HAProxy with Datadog for monitoring. Stacktrace: haproxy ------- - instance #0 [ERROR]: '(\'Connection aborted.\', BadStatusLine("\'\'",))' - Collected 0 metrics, 0 events & 0 service checks

The reason was my EC2 box url was accessible with https that causes ssl was enable.After adding 'disable_ssl_validation: true' in my haproxy.yaml in data-agent/conf.d/haproxy.yaml it worked

Upvotes: 0

Related Questions