What to do when the access denied in DigitalOcean Spaces? Let’s see the details. At Bobcares, with our DigitalOcean Managed Service, we can handle your issues.
Why Access Denied in DigitalOcean Spaces?
We can store and serve data on DigitalOcean’s (DO) Spaces, a storage area that is similar to Amazon S3. Files uploaded to the Space buckets will automatically have their permission set to Private. If we use a browser to attempt to open any of these files publicly, we will be taken to an error page.
A Simple Workaround
When we use Transmit to upload files to our Spaces bucket, we run into the identical issue.However, we can simply fix it by including the x-amz-acl Amazon S3 ACL request header. Every file posted to the bucket will have this header showing that it is publicly viewable.
Transmit can have this header added to it so that any files containing the header will be sent. After that, the files will show up in the DO dashboard with Permission: Public.
We can add the header as follows:
1. Open Transmit and go to Preferences.
2. Click on the Cloud Tab.
3. Under the Extension column, select Default.
4. Click the “+” sign and choose “x-amz-acl” for Name, and “public-read” for Value.
We need to disconnect and reconnect if we’re already using Transmit to connect to a DO Space bucket. Any files we upload via Transmit to the Spaces bucket going forward will be publicly available and browser-accessible by default.
Additionally, if we faced a “403 Forbidden” error during the upload process, it might be because the AWS_DEFAULT_ACL setting was missing in the settings.py file when we ran python manage.py collectstatic. We can fix this by manually setting the permissions of the problematic files to “public-read”. To prevent this issue in the future, it’s best to add AWS_DEFAULT_ACL = ‘public-read’ to the settings.
[Looking for a solution to another query? We are just a click away.]
Conclusion
This article offers the steps from our Tech team to take when the access denied issue arise with the DigitalOcean Spaces.
0 Comments