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!
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.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.