Question

Why do I get 403 errors for some Spaces objects?

Hello,

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 https://zonnegrens-nl-kjmoe.ondigitalocean.app/ (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: https://ams3.digitaloceanspaces.com/zonnegrens/static/images/header.jpg

Same goes for https://ams3.digitaloceanspaces.com/zonnegrens/static/images/web-app-icon-192x192.png (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!

Gijs

Subscribe
Share

Also, the CORS setting has GET, HEAD as allowed methods


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Accepted Answer

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