Report this

What is the reason for this report?

digitalocean spaces showing accesskeyid and expiresid in image/staic files url?

Posted on March 15, 2020

hi i am using django and i have setup a digitalocean spaces for public upload. now everything is working correctly. but it is showing accesskeyid expiresid in images/staticfiles url in html page. i dont want to show access keyid and expiresid with images/static files url for example: https://nyc3.digitaloceanspaces.com/example/medias/kmml/trki1d-7321-447f-8346-93.jpg?AWSAccessKeyId=jhbfjbfjdfkjigfji&Signature=wSdPz8x6Co%2BYmThvG9yi09j9418%3D&Expires=1584285699

i just want it to be https://nyc3.digitaloceanspaces.com/example/medias/kmml/trki1d-7321-447f-8346-93.jpg in html.



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.

To remove the AccessKeyID and Expires from your DigitalOcean Spaces image URL, you’ll want to make your Space public. By doing this, you’d ensure that your files are accessible without authentication parameters.

Here’s how to make your DigitalOcean Space public:

  1. Log in to your DigitalOcean Control Panel.
  2. Click Spaces on the left side menu.
  3. Click on the name of the Space you want to make public.
  4. Click on the Settings tab on the top navigation bar.
  5. Under the File Listing section, switch the toggle from Restricted to Public.

Keep in mind that making your Space public allows anyone with the file URL to access the content. If you still want to keep your Space restricted, you can create a proxy for your images and serve them through your backend (Django) without exposing the access key.

For more details on working with Django and DigitalOcean Spaces, check out the DigitalOcean tutorial on setting up object storage with Django.

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.