By PiperAlpha
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!
Accepted 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://**.fra1.digitaloceanspaces.com/1.txt
to https://**.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:
Let me know how it goes! Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.