Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Access denied for files uploaded to digital ocean private folder after I added the custom domain

Ask Question

I use django and serve media with digital ocean. Private files are uploaded to the private folder and media to the media folder. Everything works fine. The problem is when I try to use my custom domain. I want users to click on the file and get the file at media.mydomain.com and not sfo.digitalocean.com .

After I added the custom domain, I got an Access Denied if click to access media file.

<Error>
<Code>AccessDenied</Code>
<BucketName>exitma</BucketName>
<RequestId>tx000000000000046cc93c9-006358c390-213dd0f0-sfo3a</RequestId>
<HostId>213dd0f0-sfo3a-sfo3-zg01</HostId>
</Error>

If I include custom_domain=False in my storagebackend.py then media URL works but the access goes to digitalocean.com and not custom domain (media.mydomain.com). My question is....Is it possible for users to access private file via {{media.url}} at a custom domain instead of sfo3.digitaloceanspaces.com?

class PrivateMediaStorage(S3Boto3Storage):
    location = 'private'
    default_acl = 'private'
    file_overwrite = False
    custom_domain = False
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.