简体   繁体   中英

Curl error “no alternative certificate..”

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM