Moved to another domain but API doesn't work

Andy W

Member
Hi

I've moved my MW installation to a different vps and better domain name (yes again, but this time is definitely the last time!). I followed the instructions here and everything works fine, except for the API. In the code that calls the API I simply changed olddomain.com/api to newdomain.com/api. They were both already using https. Now whenever the API is called I get he response 'ssl connect error' shown in the attached image. Do you have any pointers for me to look at?

I tried adding /index.php to the end of the apiUrl but it made no difference. Connections to the site and the main MW application through a browser look good in the SSL connections and permissions area.
 

Attachments

  • sslerror.jpg
    sslerror.jpg
    17.2 KB · Views: 13

twisted1919

Administrator
Staff member
Hey Andy,

Maybe curl (the library php uses to make remote connections) doesn't properly understand the ssl version you are using on that server.
You could edit the file "/MailWizzApi/Http/Request.php" and add
PHP:
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
at line 144 before this block:
PHP:
$body  = curl_exec($ch);

Give it a try and lemme know.
 

Andy W

Member
I've tried that, and unfortunately it still doesn't work. There's a cache directory in /MailWizzApi/ - should I be clearing that at all?
 

twisted1919

Administrator
Staff member

Andy W

Member
No, it doesn't work either if I use http instead of https. The htaccess file was forcing api calls to go via https, but when I renamed this file to temporarily try it without https I got this message instead of the ssl connect error:

[status] => error
[error] => Not Found

Does this point to it not really being an ssl issue at all?

I tried the quick fix mentioned in that blog post and that didn't make any difference either.
 

Andy W

Member
Removed sensitive information, as for some reason this has just started working - two days after the move was completed!

Thanks for your help in trying to debug this...
 
Last edited:

Andy W

Member
I thought I'd return to this post and add the solution, in case it affects anyone else. I had bought a shiny new VPS and got it all set up to run Mailwizz on a new domain that I'd purchased. I ordered a new SSL certificate to go with it. When it was all installed, browsing the site through https:// looked fine - with the green background to the https part of the domain name. However, being the owner of the site I had clicked on that green part and in the connection details Google Chrome was saying that the site used outdated cryptography to secure my connection. I had my server guy work on this so now it says 'is encrypted with modern cryptography'. Success I thought!

Then I was having problems with https api calls from other servers. It turns out that even nowadays most default installations of php etc come with curl c7.19‏ - which is a few years old. When we have upgraded curl on these servers to v7.41 the api calls succeed. That cost me many hours of searching and trying, so hopefully it may save someone else the same!
 
Last edited:

twisted1919

Administrator
Staff member
Thanks for sharing, i am developing on php 5.6.6 and most likely this is why i haven't hit this issue before, but i did get issues where the default server certificate was not accepted by the remote end and i had to generate new ones for this to work, weird issues.
 
Top