Why do I get 403 errors for some Spaces objects?

Posted November 18, 2020 1.2k views
DigitalOcean Spaces


I’ve setup a Django app with a Space linked to it.

Most files load properly, but somehow some files images won’t.

For example, if you look here (ignore fake warning, the original one is also mine, I’m migrating from a droplet to an app)

You’ll see the file header.jpg gets a 403 Forbidden.
If I open it without the query parameters, it loads. So the file exists but just is forbidden:

Same goes for (also 403 while the site loads)

All the other assets load without problems.

The bucket is public.

I’ve set CORS to the DO-generated domain name.

One thing I noticed is that the header image is loaded from CSS as a background-image and the others are loaded via image tags.

Am I missing something?

Thanks a lot!


1 comment

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.

Submit an Answer
1 answer

It has to do with html entity encoding of the URLs. Probably something with the setup of django-storages or boto3.