Skip to content
Website Security

DDoS Protection for Websites: Types & How to Defend

What DDoS attacks are, the main types, and how CDNs, firewalls and hosting choices protect your website from going offline.

Hero: padlock and shield over a browser address bar showing HTTPS, for “DDoS Protection”
Quick answer

A DDoS (Distributed Denial of Service) attack floods a website with traffic from thousands of compromised devices so real visitors cannot reach it. The most effective DDoS protection for most websites is a CDN or proxy with built-in mitigation, such as Cloudflare, combined with a web application firewall, rate limiting and caching. Hide your origin server’s IP address so attackers cannot bypass the protection.

What is a DDoS attack?

In a denial-of-service attack, an attacker overwhelms a server with requests. A distributed attack uses many devices at once — often a botnet of hacked computers, routers and IoT devices — which makes it hard to block by IP address alone.

Types of DDoS attacks

TypeLayerHow it works
VolumetricNetwork (L3/L4)Saturates bandwidth with huge amounts of traffic (e.g. UDP floods, amplification)
ProtocolNetwork (L3/L4)Exhausts server or network equipment resources (e.g. SYN floods)
Application layerApplication (L7)Sends many legitimate-looking HTTP requests to expensive pages such as search or login

Signs of a DDoS attack

How to protect your website

01

Put a CDN with DDoS mitigation in front

Providers such as Cloudflare absorb network-level attacks across their global capacity.

02

Hide your origin IP

Only allow web traffic from your CDN; do not expose the server IP in DNS or email headers.

03

Use a WAF and rate limiting

Block abusive patterns and limit requests to login, search and form endpoints.

04

Cache aggressively

Cached pages are cheap to serve and keep the site up under load.

05

Choose capable hosting

Hosts with network-level DDoS protection and the ability to scale reduce downtime.

06

Have a plan

Know how to enable “under attack” modes, who to contact at your host and how to communicate with users.

Note: Not every traffic spike is an attack. Viral content or a sale can also overload a site — caching and a CDN help in both cases.

Related guides: Cloudflare, website firewalls and what is a CDN.

A plan you can prepare today

01

Put your site behind a service that filters traffic, such as Cloudflare, and confirm it is active.

02

Keep your server’s real IP address private. Old DNS records and email headers can reveal it.

03

Ask your host what they do during an attack, and whether they might take your site offline.

04

Write down who to contact, with account details, somewhere other than the website.

05

Keep a recent backup in a different place.

What to do during an attack

01

Check that it is an attack. A popular post, a failing plugin or a busy bot can look similar.

02

Turn on your provider’s “under attack” or challenge mode.

03

Contact your host and send them times and log samples.

04

Rate-limit the login, search and checkout pages.

05

Tell customers through email or social media if the site is down.

06

Save logs. You may need them for a report.

Do not pay anyone who threatens an attack. Payment does not guarantee it stops. In the USA you can report it to the FBI’s IC3, in the UK to Report Fraud, in Canada to the Canadian Anti-Fraud Centre and in Australia to the Australian Cyber Security Centre.

Is a small site really a target?

Small sites are rarely singled out, but they can be hit by automated traffic, by a dispute, or because they share a server with a target. A free protection plan is enough for most of them.

Keep learning

More in Website Security

Website Security Checklist

A practical, printable website security checklist covering accounts, updates, hosting, backups, HTTPS, monitoring and incident response.

Website Malware

How to tell if your website has malware, how to clean it step by step, how to get off Google’s…

Website Firewall (WAF)

What a web application firewall does, cloud vs plugin vs server firewalls, and how to choose and configure one for…

Latest articles

Related Website Security articles

FAQ

DDoS Protection questions, answered

Short, honest answers to the questions people ask most about this topic.

Can a small website be DDoSed?

Yes. Attacks are cheap to launch and sometimes target small businesses, competitors or sites caught in wider attacks. A CDN with DDoS protection is an affordable safeguard.

Yes. Cloudflare includes unmetered DDoS mitigation on all plans, including free. Paid plans add more advanced firewall and rate-limiting controls.

Launching a DDoS attack is illegal in many countries, including the USA, UK, Canada and Australia, under computer misuse and cybercrime laws.

Next step

Keep building your skills

Explore the rest of our Website Security guides, or follow the beginner path step by step.