Question

Unable to interact with DigitalOcean CDN using boto3

Posted January 12, 2021 159 views
PythonPython FrameworksCDNDigitalOcean Spaces

In Wizart LLC we are using boto3 client for Python to interact with DigitalOcean Spaces.

After the CDN was enabled for our spaces, we become unable to access data stored in buckets.

For example, stored files can be accessed via the following CDN link:

https://wizart-storage-data-dev.fra1.cdn.digitaloceanspaces.com/interiors/uploaded/images/07IRgHJ2PFhVqVrJDCIpzhghqe4TwK1cSSUXaC4T.jpeg

But boto3 SDK generates URLs like this one given in the form:

https://fra1.cdn.digitaloceanspaces.com/wizart-storage-data-dev/interiors/uploaded/images/07IRgHJ2PFhVqVrJDCIpzhghqe4TwK1cSSUXaC4T.jpeg

which seems to be an invalid CDN URL for DigitalOcean Spaces.

When CDN is not specified - the file is accessible with no problems:

https://fra1.digitaloceanspaces.com/wizart-storage-data-dev/interiors/uploaded/images/07IRgHJ2PFhVqVrJDCIpzhghqe4TwK1cSSUXaC4T.jpeg


Is any workaround can be applied in our case?
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!