Using Spaces with Laravel - cURL Error 60

Posted March 22, 2021 2k views
PHP FrameworksDigitalOcean SpacesLaravel

I am attempting to connect to a Digital Ocean Space from a Laravel 8 webapp using PHP 8. Whenever I try to upload a file, I get this error:


Error executing "PutObject" on 
AWS HTTP error: cURL error 60: SSL: no alternative certificate subject name matches target 
host name '[MY-SPACE-NAME]' 
(see for 

Here is my config file:

'spaces' => [
    'driver' => 's3',
    'key' => env('SPACES_KEY'),
    'secret' => env('SPACES_SECRET'),
    'endpoint' => env('SPACES_ENDPOINT'),
    'region' => env('SPACES_REGION'),
    'bucket' => env('SPACES_BUCKET'),

… and my .env file:


If I add “https://” to the start of the endpoint, it seems to want to prefix the space name before the protocol, ending up with this:
[MY-SPACE-NAME]., which obviously throws up another error (cURL error 1).

In the other threads I’ve seen relating to this issue, the suggested solution has been to either uppercase the region (which has no effect in this case) or add ‘https://’ to the endpoint, which doesn’t work either. Prefixing 'https://’ to the space name yields the correct URL but the same error: cURL error 60. Usually this problem occurs on Windows-users’ local dev environments, so I can’t figure why this is happening in my case (both in my local dev environment on macOS and on a server running Ubuntu.

Some assistance would be most appreciated. Thanks.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi there,

I think that I’ve seen a similar problem here:

I believe that the error is occurring as you are not using https:// for your Spaces URL.

So you need to change http://** to https://**

For more information, I would recommend following the steps here on how to integrating an S3-Compatible Object Storage into your Laravel Application:

Let me know how it goes!

by Bobby Iliev
by Erika Heidi
Data persistence and file storage represent two of the biggest challenges when horizontally scaling web applications. This is mainly due to the fact that it is hard to maintain consistency of variable data between multiple application nodes. A practical way of meeting these demands is by using managed databases and object storage. In this guide, we will update an existing Laravel 6 application to use a managed MySQL database and an S3-compatible object store.
  • Hi Bobby. Thanks for your answer.

    I would advise you to read the question more thoroughly before answering next time. I did state that I’ve been trying to add https:// to the endpoint URL but it does nothing to solve the problem. I’m not using http://, so I don’t know where you’re getting that.

    Yeah, I’ve seen the question and the guide you mention, but they dont help in solving my issue either unfortunately.

    Do you have any other explanation for why this could be happening?


    • Hello,

      Are you using the league/flysystem-aws-s3-v3 package?

      If not, the package that you are using seems to be incompatibe, as the URL that it ends up using is basically incorrect as it is appended 2 times:


      Here is an open-source project based on Laravel 8 that I’ve built a few months ago that uses the same implementation:

      The configuration is as follows:

      • S3 implementaiton with league/flysystem-aws-s3-v3
      • Settings in .env:
      • The filesystems.php:
              'spaces' => [
                  'driver' => 's3',
                  'key' => env('DO_SPACES_KEY'),
                  'secret' => env('DO_SPACES_SECRET'),
                  'endpoint' => env('DO_SPACES_ENDPOINT'),
                  'region' => env('DO_SPACES_REGION'),
                  'bucket' => env('DO_SPACES_BUCKET'),

      It did not work without the https:// protocol specified in the spaces endpoint env variable. After adding the https:// and using dd it correctly constructed the hostname as follows:


      • I am indeed using league/flysystem-aws-s3-v3. However, I think there was a mixup in both my local dev environment and on the server I was testing against. I’ve been juggling PHP 8 and PHP 7.4 lately and I think I accidentally ran composer update while PHP 7.4 was active. Later I switched to PHP 8 without updating the dependencies.

        I was beginning to suspect this was an issue on my end due to the scarcity of similar error reports lately.

        Thanks a bunch for taking the time to answer my question Bobby :-)