cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Upload API issue

Upload API issue

Synk
Explorer | Level 3

Hi everybody,
I'm using Dropbox API in my web application to upload files to Dropbox via PHP code.

I've been using this procedure for a long time, but today I got an upload error:
"Failed to upload in Dropbox: URL Error: SSL certificate problem: self signed certificate in certificate chain - HTTP Error: 0".

I'm using the following settings:

        $ch = curl_init('https://content.dropboxapi.com/2/files/upload');
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE); 
        curl_setopt($ch, CURLOPT_CAINFO, $_SERVER['DOCUMENT_ROOT'] . "certificate_path/cacert.pem");
        curl_setopt($ch, CURLOPT_HTTPHEADER, $cheaders);
        curl_setopt($ch, CURLOPT_PUT, true);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
        curl_setopt($ch, CURLOPT_INFILE, $fp);
        curl_setopt($ch, CURLOPT_INFILESIZE, $size);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);


I tried to download a new cacert.pem, but the upload still fails.
I also tried to disable the SSL, but unsuccessfully.

Any suggestions would be really appreciated,
Thank you very much

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff

@Synk Здравко is correct; the Dropbox API requires TLS (v1.2 in particular, currently), and is currently being served with a valid certificate (from DigiCert). You generally shouldn't need to configure anything manually to be able to connect to that; the default is usually sufficient. We recommend against disabling the verification, as that may make you susceptible to certain types of security issues.

 

As for why this started occurring, you may want to check if there's anything on your network connection, such as a proxy, VPN, firewall, or other security software that may be interfering with your connections to the Dropbox servers.

View solution in original post

5 Replies 5


@Synk wrote:

...
I tried to download a new cacert.pem, but the upload still fails.
...


Hi @Synk,

Why at all do you need explicit certificate set?! All Dropbox sites (including all API domains) are certified by DigiCert. :slightly_smiling_face: You don't need to set anything. If by any chance you need to connect some self signed domain, do it on that connection only. You don't need to change that for all connections (including Dropbox API related).

Good luck.

Synk
Explorer | Level 3

Hi @Здравко ,
Thank you very much for your reply.

I need to keep SSL for security reason. So if I don't explicitly set a certificate, it doesn't work.

if I set VERIFYPEER = FALSE, the upload actually works. But I believe this is not secure? Otherwise what's the purpose of this option?

I don't understand why I started to receive this error from this month. I've been using the upload API for over 10 years already with a generic cacert.pem file, and it has always worked correctly. I also tried to download a new version of cacert.pem, but nothing changed...

Thanks,
Kind regards


@Synk wrote:

...
I need to keep SSL for security reason. So if I don't explicitly set a certificate, it doesn't work.
...


@Synk, As seems you have misinterpret my comment. I never said  to turn your SSL off neither SSL verification! To be more precise Dropbox uses TLS, by the way. That what I take in mind is that a typical setup comes with all most popular basic certificates preset (including DigiCert - the one used by Dropbox). Usually you don't need to add/include such a certificate since its there already. If this is not true for you, check your server setup configuration. I doubt somebody here can lead you to custom setup configuration issue - this is something very specific. Find how you have turned that certificate out and revert back; that's it.

Have a nice day.

Greg-DB
Dropbox Staff

@Synk Здравко is correct; the Dropbox API requires TLS (v1.2 in particular, currently), and is currently being served with a valid certificate (from DigiCert). You generally shouldn't need to configure anything manually to be able to connect to that; the default is usually sufficient. We recommend against disabling the verification, as that may make you susceptible to certain types of security issues.

 

As for why this started occurring, you may want to check if there's anything on your network connection, such as a proxy, VPN, firewall, or other security software that may be interfering with your connections to the Dropbox servers.

Synk
Explorer | Level 3

Hi,
Thanks to both of you @Здравко and @Greg-DB .
It was actually a proxy issue, and I had the update the certificates accordingly with the new proxy configuration.

Thanks for your support,
Cheers

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Synk Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?