How to ensure the security of CDN?

I want to put the static pictures on the website into spacing and enable CDN acceleration, and use the URL of the CDN endpoint to access the pictures in the code. How can I limit the traffic of the CDN and the number of visits within a certain period of time when the website is accessed or even attacked on a large scale?

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.

Site Moderator
Site Moderator badge
May 5, 2023
Accepted Answer

Hello @joejo

To limit traffic and requests for your static assets, you can use CDN rate limiting and DDoS protection. Rate limiting can be implemented using third-party CDN providers like Cloudflare, which allows you to set custom rules for traffic and requests mitigation. You can also explore the Cloudflare firewall settings to block or challenge requests matching specific criteria.

Additionally, consider enabling DDoS protection services, like DigitalOcean’s Cloud Firewall, to protect your website from potential attacks. Cloud Firewalls are free and perfect for staging and production deployments.

Have in mind you can implement additional rules on your droplet as well. If you run iptables you can set certain rules or have your web-server (Apache/Nginx) to block access to specific resources.

Hope that this helps!

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