I’m using DigitalOcean Spaces to host files for my website, and I want to restrict access to these files so that they can only be accessed when they are embedded or linked from my website. For example, if someone tries to directly access a file by typing its URL (e.g., https://cdn.example.com/image.png
) into their browser, they should not be able to view or download the file. However, if the file is embedded in my website using an HTML <img>
tag or linked to from my site, it should be accessible.
I’m particularly concerned about serving large zip files on my CDN. If these files are accessible to anyone with the link, they could be published on other sites, leading to excessive bandwidth usage.
Is there a way to configure DigitalOcean Spaces or use other techniques to ensure that files hosted on my CDN are only accessible when accessed through my website? Any insights or recommendations on how to achieve this?