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:
Aws\S3\Exception\S3Exception
Error executing "PutObject" on
"//[MY-SPACE-NAME].ams3.digitaloceanspaces.com/[MY-SPACE-NAME].ams3.digitaloceanspaces.com";
AWS HTTP error: cURL error 60: SSL: no alternative certificate subject name matches target
host name '[MY-SPACE-NAME].ams3.digitaloceanspaces.com'
(see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for
https://[MY-SPACE-NAME].ams3.digitaloceanspaces.com/[MY-SPACE-NAME].ams3.digitaloceanspaces.com
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:
SPACES_KEY=****
SPACES_SECRET=****
SPACES_ENDPOINT=ams3.digitaloceanspaces.com
SPACES_BUCKET=[MY-SPACE-NAME]
SPACES_REGION=ams3
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].https://ams3.digitaloceanspaces.com
, 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.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Hi there,
I think that I’ve seen a similar problem here:
https://www.digitalocean.com/community/questions/can-t-disable-ssl-on-space-curl-error-60-ssl-no-alternative-certificate
I believe that the error is occurring as you are not using
https://
for your Spaces URL.So you need to change
http://**.fra1.digitaloceanspaces.com/1.txt
tohttps://**.fra1.digitaloceanspaces.com/1.txt
.For more information, I would recommend following the steps here on how to integrating an S3-Compatible Object Storage into your Laravel Application:
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-scalable-laravel-6-application-using-managed-databases-and-object-storage#step-5-—-integrating-an-s3-compatible-object-storage-into-the-application
Let me know how it goes! Regards, Bobby