Question

Using Spaces, I get a (403) Forbidden error when trying to load an image on my website.

I have a few files uploaded to my spaces droplet (if that is the correct terminology). When I attempt to access a .jpg image from my website, the console throws a (403) Forbidden error when trying to access it.

Thanks to everyone in advance.


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

In my case, I integrated the S3 API with a Laravel application. And then used Laravel Media Library to upload (PUT) and view (GET) images on the site… Even though uploading was okay, I was getting 403 forbidden requests for viewing those files!

And thanks to the support, they pointed out that you can view the individual file’s permission within the Space storage in DigitalOcean, and then it hit me! The files were uploaded without the necessary x-amz-acl header that is set to public-read and it was defaulted to private!-_-’

https://developers.digitalocean.com/documentation/spaces/#object

Anyhow, thanks to the amazing Laravel Media Library package, its configuration included an array for extra headers to be attached to the PUT HTTP requests.

Spaces is DO’s Object Storage solution as opposed to Droplet’s which is a compute platform :-)

Usually files uploaded to Spaces are private by default. You can chance the setting at a file level for every file you upload. Can you please make sure your files are not uploaded with the default “private” setting? If it is, please switch this to public. You can do this from our cloud portal or via our API.