I've been working with an API for some time now with which calls work for the majority of the time however occasionally (1 to 2 times a day for around an hour, although it's completely unpredictable when and how long for!) I get the following error message:
"An error has occurred: SSL: no alternative certificate subject name matches target host name 'api.xxxxx.com'"
I've been monitoring the api both with scheduled calls from my server and externally using runscope and also manually with Postman. When my server calls have the issue runscope and Postman do not suggesting it's a problem on my side.
FYI I'm querying the api from a linux server using PHP to run basic authentication with both file_get_contents and Curl - both approaches display the same issue.
Having worked with the super helpful api owner dev team it appears that, upon using the openssl command:
echo | openssl s_client -showcerts -servername api.XXXXX.com -connect api.XXXXX.com:443 2>/dev/null | openssl x509 -inform pem -noout -text
my server is somehow pointing the api's domain to my own, i.e. this command outputs my own ssl certificate and not that of the api.
Does anyone know how to fix this and/or stop this happening again?