Question

How to allow access to files on Spaces from only my website

Hello, is it posssible to allow access to files from only my website and not directly?

For example when someone type https://cdn.example.com/image.png from their browser they shouldn’t have access this file but when I put <img src="https://cdn.example.com/image.png" in my website it should have accessible. Is this possible?

I ask this because I plan to serve large zip files on my CDN, and if these files are accessible to everyone who has a link to them, they can be published on other sites and my bandwidth can fill up quickly. How do I ensure that these files are only downloaded from my site?


Submit an answer


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!

Sign In or Sign Up to Answer

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.

alexdo
Site Moderator
Site Moderator badge
April 26, 2024
Accepted Answer

Heya,

This definitely sounds doable. I believe one way to achieve this will be using a pre-signed URLs.

A pre-signed URL is a connection URL created by an authorised user so that unauthorized users can access restricted resources without sharing credentials.

You can find more information here:

https://docs.digitalocean.com/glossary/pre-signed-url/

Regards

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel