Curl error “no alternative certificate..”

守給你的承諾、 提交于 2021-02-08 04:43:42

问题


We have a problem in only one of our servers hosted at Amazon (the development server). The problem happens when doing a curl request to a specific domain, by running this:

> curl https://api.plivo.com

Results in:

curl: (51) SSL: no alternative certificate subject name matches target host name 'api.plivo.com'

I did some research and found out that it might be a problem with the server's certificate, however if I try this from any other server it works fine, same on my local machine. So I'm thinking that this might be a cache issue from curl? I tried reinstalling it, updating it, but no dice. I'm almost creating a new dev machine because of this, because it's blocking us from using this service.


回答1:


To summarize from the comments:

  • The good and the bad system actually accessed different servers which were configured with different certificates. That's why it failed on one system but not on the other.
  • The reason for this difference was that the bad system had an entry in /etc/hosts which was used instead of asking the DNS server.
  • The problem was found by comparing the output of curl -v and realizing that the shown target IP address was different.
  • The problem was fixed by removing the old entry in /etc/hosts so that it now queries the DNS server and gets the correct IP address of the server.


来源:https://stackoverflow.com/questions/46481532/curl-error-no-alternative-certificate

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!