- A CDN serves files from points close to the visitor, reducing load time and server pressure.
- DDoS attacks flood a site with fake requests; protection requires a network bigger than the attack.
- A web application firewall (WAF) blocks common hacking attempts before they arrive.
- Hiding the real server address and only allowing connections through the network completes the protection.
- Test after enabling it: forms, payment, the dashboard and cache purging.
On the day of a big campaign launch, in a peak season, or even on an ordinary day for no clear reason, your site may be hit by a flood of requests beyond the server’s capacity. Sometimes it’s genuine success in attracting visitors; sometimes it’s a deliberate attack aimed at taking the site down; and often it’s automated bots probing the site for vulnerabilities. In every case, a server standing alone facing the internet bears it all.
A content delivery network (CDN) combined with a web application firewall (WAF) changes that equation. In this article we explain how they work and why they’ve become a core part of the setup we recommend in our hosting service.
How does a content delivery network work?
Without a CDN, every visitor goes directly to your server, wherever it is. A visitor in Jeddah and a server in Europe means every image and file travels a long distance. With a CDN, a network of servers distributed around the world sits between the visitor and your server. When the visitor requests a page, the request goes to the nearest point in the network. If the files are stored there, they are served immediately. If not, the network fetches them from your server once and keeps them for the next visitors.
| Benefit | How it’s achieved |
|---|---|
| Higher speed | Files from the point geographically closest to the visitor |
| Less pressure on the server | Most requests are served by the network, not the server |
| Stability at peaks | The network absorbs sudden surges |
| Protection | Filtering attacks and malicious requests before they arrive |
| SSL and modern protocols | Managed certificates, HTTP/3 and automatic compression |
| Hiding the server | Visitors see the network’s address, not your server’s |
What are DDoS attacks?
A distributed denial-of-service (DDoS) attack uses thousands or millions of compromised devices around the world to send requests to your site at the same time, aiming to exhaust its resources until it stops serving real visitors. The main types:
| Type | What it targets |
|---|---|
| Volumetric attacks | Flooding the network connection with huge amounts of data |
| Protocol attacks | Exhausting the resources network equipment and servers use to manage connections |
| Application-layer attacks | Normal-looking requests to heavy pages (search, login) that exhaust the server |
A single server, however powerful, can’t withstand a large attack, because the attack is simply bigger than its capacity. Effective protection comes from a huge distributed network able to absorb and filter the attack — which is what the major CDN services provide.
The web application firewall (WAF)
If DDoS protection deals with quantity, a WAF deals with type: it inspects requests and blocks the harmful ones, such as SQL injection attempts, script injection, exploits of known vulnerabilities in WordPress and its plugins, and password-guessing attempts. Many of its rules are based on the most common risks documented in the OWASP Top 10. Key settings:
- Managed rules: rule sets the provider updates automatically to counter new vulnerabilities.
- Rate limiting: stopping a single address from sending many requests to the login page, search or forms.
- Login page protection: an extra challenge or geographic restriction on the dashboard login page.
- Bot management: allowing legitimate search engine crawlers and blocking malicious bots.
- Geographic rules: if your business is entirely local, you can tighten protection for regions you don’t serve — carefully, so you don’t block clients or search engines.
Hiding the real server
Protection loses its value if an attacker can reach your server directly, bypassing the network. So:
- Make sure all the site’s DNS records go through the network.
- Configure the server firewall to accept web connections only from the network’s address ranges.
- Watch out for records that may reveal the server’s address, such as the mail record if email is on the same server — another reason to separate email from the website server. Read business email.
- If the server’s address was publicly known before, consider changing it after enabling protection.
Essential settings when enabling a CDN
| Setting | Recommendation |
|---|---|
| SSL mode | Full encryption between visitor and network and between network and server, with a valid certificate |
| Redirect to HTTPS | Enabled, avoiding double redirects |
| Caching static files | Enabled with suitable durations |
| Caching pages | Carefully, excluding the dashboard, cart, checkout and account |
| Cache purging | Automatic when content is updated, via a plugin or integration |
| WAF and managed rules | Enabled, reviewing the logs for the first two weeks |
| HTTP/3 and compression | Enabled |
Mistakes that break sites when it’s switched on
- An infinite redirect loop: caused by mismatched SSL settings between the network and the server.
- Caching personal pages: so one user sees another user’s cart.
- Blocking legitimate requests: rules that block the site’s forms, the payment gateway or app APIs.
- Not purging the cache: so changes don’t appear.
- Logging visitors’ addresses wrongly: the server sees the network’s address instead of the real visitor’s, breaking protection limits and statistics; the server must be configured to read the real address from the headers.
So test after enabling it: browse the site, submit the forms, complete a test purchase, log into the dashboard, and edit a page to check the change appears.
What to do during an attack
If you notice severe slowness or downtime with an abnormal rise in requests, don’t start by restarting the server over and over. Open the network’s dashboard and review the sources of the requests and the targeted pages. Most services offer a high-security mode that challenges every visitor temporarily until the attack subsides; enable it, add rate-limiting rules on the targeted pages, and contact the provider’s support if your plan includes immediate support. After the attack, return the settings to normal so visitors aren’t inconvenienced, and document what happened — when it started, which pages were targeted and which measures worked — so you can adjust your permanent rules and respond faster and more calmly next time. If you have an ad campaign running, pause it until the site is stable; there’s no point paying for visitors who can’t get through.
When do you need stronger protection?
If your site is a store with daily sales, a platform clients rely on, an organisation likely to be targeted (government, financial and security sectors), or has been attacked before, you may need advanced plans with stronger protection against application-layer attacks, immediate support during an attack and detailed reports. For organisations subject to the National Cybersecurity Authority’s controls, review the requirements that apply to your case, including those on where data is located and processed. Read data residency in Saudi Arabia.
CDNs, apps and APIs
If you have a mobile app that connects to a server through APIs, the same network can protect them too: rate-limiting requests per user, blocking malformed requests and easing load at peak times. But the caching rules here are completely different; most API responses are personal and must not be cached, so special rules are set for API paths that exclude them from caching and apply protection only. Read app security.
The bottom line
A content delivery network with a web application firewall gives your site higher speed, stability at peak times and protection against denial-of-service attacks and common hacking attempts, at a cost suitable even for small sites. Enable it with the right settings, hide your server and test thoroughly. We configure this within hosting, alongside WordPress security from the inside. Get in touch.
Real projects we delivered
FAQ
Is a CDN suitable for small sites?
Yes. Many CDN providers offer free or low-cost plans that include acceleration, basic protection and an SSL certificate, and they help even small sites.
Does a CDN affect SEO?
Usually positively, by improving speed. Just make sure protection rules don’t block search engine crawlers, and that redirects and certificates are correct.
How do I know my site is under attack?
Common signs: sudden severe slowness or downtime, abnormal traffic spikes from unusual sources, and exhausted server resources. CDN and server dashboards reveal this.
Does protection replace keeping the site updated?
No. The firewall is an extra layer, but the site must stay updated and secured from the inside.
Sources
Want this applied to your project?
Book a free consultation — we will review your site or brand and propose a clear plan.
Book a free consultation






