Report this

What is the reason for this report?

Nginx (403) Forbidding some static files from DO Spaces Django.

Posted on April 30, 2021

I am using Nginx with Django. All configuration are made according to docs provided by DO and everything works fines except I am getting following Error for some of my static files served through DO spaces. When I’m making those files ‘Public’ the error goes away from DO spaces dashboard. I am confused that some files having permission ‘private’ are loading and some have to made ‘public’. Example files in tinymce folder have to be made ‘public’ or files which are in vendor folder.

Error in my Console: GET https://sgp1.digitaloceanspacenet: spaces/static/tinymce/js/tinymce/plugins/textcolor/plugin.min.js :ERR_ABORTED 403 (Forbidden)

Is there any way to give permission to those files without making them ‘public’? or if not any way to make them ‘public’ all at once?



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!

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.

Heya,

Just came across this answer and decided to write some general guidelines for anyone who comes across this in the future despite the old question.

When using DigitalOcean Spaces, the access rights of individual objects are determined by the permissions you set. When a file is marked as ‘Private’, direct access is denied, hence the 403 (Forbidden) error you’re encountering. If you want to avoid making these files ‘Public’, one alternative would be to use the Spaces CDN, which creates a unique URL to serve your file while keeping it ‘Private’. Configuring your application to use the CDN link can bypass the need to adjust individual file permissions.

To change your static files to ‘Public’ all at once, you would need to use an S3-compatible tool or script to adjust the permissions in bulk.

For more detailed information on object permissions in Spaces and using the Spaces API to programmatically manage these permissions, please refer to these DigitalOcean Docs.

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.