Question

Spaces Laravel cURL 60 no alternative certificate error

So I am trying to upload an image to DO’s spaces, it gives me this error

https://bucketName.bucketName.nyc3.digitaloceanspaces.com/ragbag/generatedImageName.jpg”; AWS HTTP error: cURL error 60: SSL: no alternative certificate subject name matches target host name ‘bucketName.bucketName.nyc3.digitaloceanspaces.com’ (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://bucketName.bucketName.nyc3.digitaloceanspaces.com/ragbag/generatedImageName.jpg

This is my laravel code

public function uploadImage2(Request $request)
{
    $file = $request->file('image');
    $storage = Storage::disk('spaces')->putFile('ragbag', $file);

and the file system config setup

    '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'),
        'throw' => true,
    ]

In the DO’s bucket storage configs, I set the Restrict File Listing to Restrict File Listing, CDN is disabled.

cURL 60 means The remote server’s SSL certificate or SSH fingerprint was deemed not OK. This error code has been unified with CURLE_SSL_CACERT since 7.62.0. Its previous value was 51.


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
March 27, 2024
Accepted Answer

Hey!

As far as I can see in the error that you’ve shared, the bucket name is prepended to the URL 2 times which is the problem:

https://bucketName.bucketName.nyc3.digitaloceanspaces.com

Your settings should look as follows:

DO_SPACES_KEY=MY_KEY
DO_SPACES_SECRET=MY_SECRET
DO_SPACES_ENDPOINT=https://nyc3.digitaloceanspaces.com
DO_SPACES_REGION=fra1
DO_SPACES_BUCKET=bucketName

If you define your DO_SPACES_ENDPOINT endpoint as:

https://bucketName.nyc3.digitaloceanspaces.com it will also prepend the bucket name one more time causing the issue.

Let me know if this is the case!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel