Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

enr9's avatar
Level 1

Problem with Digital Ocean and spaces cannot be accessed

Hello,

I've a problem using Digital Ocean and spaces on Laravel 10. I filled my .env like this:


 DO_SPACES_KEY=*************

DO_SPACES_SECRET=********************

DO_SPACES_ENDPOINT=fra1.digitaloceanspaces.com

DO_SPACES_REGION=FRA1

DO_SPACES_BUCKET=****************

All the keys are working because my colleagues are using the same as me, and we even tried to generate new one.

My config/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'),

        ],

I got this error:

Disk named spaces cannot be accessed

Do you have an idea how can I fix it please ?

0 likes
4 replies
tykus's avatar

Is you config cached perhaps? Try clearing the cache

php artisan config:clear
enr9's avatar
Level 1

@tykus Hey ! Already tested to clear all type of cache

monirbk's avatar

did you install the s3 driver?

try

composer require league/flysystem-aws-s3-v3 "^3.0" --with-all-dependencies
enr9's avatar
Level 1

I installed the s3 driver, that was not the issue.

I solved the problem of "Disk named spaces cannot be accessed", by changing a line on filesystems.php.

I put that line: 'default' => env('FILESYSTEM_DISK', 'spaces'),

Now I have a CORS issue with digital ocean when I upload a file.

Access to XMLHttpRequest at 'https://********.fra1.digitaloceanspaces.com/livewire-tmp/****' from origin 'https://public.test' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

All of that is very weird, I copied the entire file of my colleagues, same env, same folder, all is the same. But I have issues, they have nothing.

Please or to participate in this conversation.