By Harry Vu
So I’m hosting image and video with DigitalOcean. But I want to block other websites use my video link on their website. Is using CORS config help? Because I tried but it doesn’t work.
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.
In order to prevent other websites from directly linking to your videos, you’ll need to execute hotlink protection. However, applying CORS policy might not be sufficient since it’s primarily designed for controlling JavaScript’s AJAX and Fetch calls between different domains, not for blocking direct access.
You might want to consider other approaches such as using .htaccess file (if using Apache server) to prevent hotlinking or configure security settings in your CDN to block non-allowed referrers.
Note: All these methods will have to be applied server-side, so make sure to take necessary precautions not to disrupt your services. Always back up your data before making any major changes.
For further details, please check DigitalOcean’s tutorials on how to set up mod_rewrite for Apache or configuring Spaces CDN in official DigitalOcean docs.
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
