Websites12 min read

Cloudflare CDN Africa: Dakar, Abidjan, Lagos optimization in 2026

Mohamed Bah·Fondateur, Kolonell
May 14, 2026
Share:
Cloudflare CDN Africa: Dakar, Abidjan, Lagos optimization in 2026

Cloudflare CDN Africa: Dakar, Abidjan, Lagos optimization in 2026

Websites

Cloudflare is the CDN with the best African coverage in 2026: Lagos, Nairobi, Cape Town, Casablanca, Tunis, Johannesburg, Mombasa, Cairo, Accra, Lusaka, Maputo, Kigali, Kinshasa, etc. Properly configured, it improves your Core Web Vitals by 30-60% on African users.

TL;DR

- Cloudflare Free tier suffices for 95% of African SMEs.

- Page Rules + Cache Rules to cache static HTML.

- Image Resizing + Polish + Mirage for images.

- Workers for edge logic (auth, A/B test).

- WAF + Bot Fight Mode for security.

Why Cloudflare in Africa in 2026

Cloudflare African PoPCountryRelevant for
Cape TownZASouth Africa
JohannesburgZASouth Africa
MombasaKEEast Africa
NairobiKEEast Africa
LagosNGNigeria + West AF
AccraGHGhana
CairoEGNorth AF + ME
CasablancaMAMorocco
TunisTNTunisia
LusakaZMSouthern Africa
MaputoMZSouthern Africa
KigaliRWRwanda
KinshasaCDDRC
DakarSNSenegal + West AF
AbidjanCIIvory Coast
CotonouBJBenin
AntananarivoMGMadagascar

Akamai, AWS CloudFront, Fastly = lower African coverage.

Step 1 — basic Cloudflare setup

  • Create account on cloudflare.com (Free tier)
  • Add your domain
  • Cloudflare scans existing DNS records
  • Change nameservers at your registrar to point Cloudflare
  • Wait propagation (24-72h)
  • Enable SSL "Full (strict)"

Step 2 — essential Page Rules (Free tier: 3 max)

Rule 1 — Cache static HTML

  • URL pattern : kolonell.com/blog/*

Settings :

  • Cache Level: Cache Everything
  • Edge Cache TTL: 4 hours
  • Browser Cache TTL: 1 hour

Rule 2 — Bypass cache for admin

  • URL pattern : kolonell.com/admin/*

Settings :

  • Cache Level: Bypass
  • Disable Performance

Rule 3 — Force HTTPS

  • URL pattern : http://*kolonell.com/*

Settings :

  • Always Use HTTPS: ON

Step 3 — Cache Rules (more modern, unlimited)

  • Rule 1 : Cache HTML pages
  • Match : (http.request.uri.path matches "^/(?!admin|api).*")
  • AND (http.response.code eq 200)

Action :

  • Cache eligibility: Eligible
  • Edge TTL: 14400 (4h)
  • Browser TTL: 3600 (1h)
  • Rule 2 : Cache API GET responses (use carefully)
  • Match : (http.request.uri.path matches "^/api/products/*")
  • AND (http.request.method eq "GET")

Action :

  • Cache eligibility: Eligible
  • Edge TTL: 300 (5 min)
  • Bypass cache on cookie: "auth-token"

Step 4 — image optimization

Polish (lossless or lossy)

`

Speed → Optimization → Polish: Lossy

`

Auto compresses JPG / PNG. 30-60% image weight savings.

Mirage (mobile)

`

Speed → Optimization → Mirage: ON

`

For 3G/4G users: loads low-res thumbnails first, then full-res.

Image Resizing (paid feature, but worth it)

  • Instead of serving a 2000x2000 px image, serve the size fitting the screen via:
  • https://kolonell.com/cdn-cgi/image/width=600,quality=75,format=auto/products/sneakers.jpg

50-80% mobile bandwidth savings.

Step 5 — security

Bot Fight Mode (free)

`

Security → Bots → Bot Fight Mode: ON

`

Blocks scraper bots that eat resources.

WAF Managed Rules (Pro plan)

`

Security → WAF → Managed Rules

  • Cloudflare Managed Ruleset: ON
  • OWASP Core Ruleset: ON

`

Blocks OWASP Top 10 attacks (SQLi, XSS, RCE, etc.).

Need a professional website?

Kolonell builds websites that attract clients, optimized for the Sénégalese market. Free quote in 2 minutes.

Rate Limiting (Free: 10K req/month)

  • Rule : 30 requests / 10 sec / IP on /api/*
  • Action : Block (60 sec)

Protects against API abuse.

Step 6 — Workers for edge logic

`js

export default {

async fetch(request, env) {

const url = new URL(request.url);

if (url.pathname.startsWith('/admin/')) {

const token = request.headers.get('Authorization');

if (!token || !await isValidToken(token, env.JWT_SECRET)) {

return new Response('Unauthorized', { status: 401 });

}

}

if (url.pathname === '/') {

const variant = Math.random() < 0.5 ? 'a' : 'b';

const response = await fetch(https://origin.kolonell.com/?v=${variant});

return new Response(response.body, {

headers: { 'X-Variant': variant },

});

}

return fetch(request);

},

};

async function isValidToken(token, secret) {

// JWT validation logic

}

`

Workers cost: $0 up to 100K req/day, $5/10M req beyond.

Step 7 — analytics + insights

`

Cloudflare Analytics → Web Analytics

`

Privacy-friendly stats (no cookies):

  • Visits
  • Performance by country
  • Browser distribution
  • Top pages
  • Errors

Complement to GA4 (which is paid + cookies).

Real case — pan-AF fashion shop

Before Cloudflare:

  • Lagos TTFB: 1,200 ms
  • Nairobi TTFB: 1,800 ms
  • Bandwidth: 80 GB/month

After configured Cloudflare:

  • Lagos TTFB: 180 ms (-85%)
  • Nairobi TTFB: 220 ms (-88%)
  • Origin bandwidth: 12 GB/month (85% cache hit)
  • Cost: $0 (Free tier)

Lighthouse Mobile Lagos: 41 → 87.

Common pitfalls

  • Too aggressive cache on dynamic content — bypass cookie auth, cart, sessions.
  • Non-strict HTTPS — Full (strict) mandatory to avoid origin-edge MITM.
  • DNS not proxied — orange cloud (proxy) vs gray cloud (DNS only). Verify.
  • Too strict CSP — Cloudflare injects JS if Rocket Loader / Mirage. Whitelist required.
  • Blocked robots.txt — verify Googlebot access. Cloudflare can block it if Bot Fight Mode misconfigured.

FAQ

Q: Free vs Pro vs Business?

A: Free enough for 95% SMEs (no Managed WAF, no Image Resizing, but base cache + DDoS included). Pro ($25/mo) unlocks Managed WAF + Image Resizing. Business ($250/mo) for SLA + custom WAF.

Q: Cloudflare blocks my African users?

A: If Bot Fight Mode too aggressive, yes. Whitelist major African ASNs (Sonatel, Orange CI, MTN Nigeria). See Security → Tools → IP Access Rules.

Q: Migration from CloudFront / other CDN?

A: Without downtime: DNS update + 48h monitoring overlap. Plan 1-2h for simple migration.

Conclusion

Cloudflare is the #1 African performance multiplier in 2026. Free tier already huge value, Pro at $25/mo unlocks everything for a medium e-commerce. 1-2h initial config = -50 to -85% latency for African users. Immediate ROI investment.

Tags:#Cloudflare#CDN#Performance#Africa#Latency#Optimization
Share:

Mohamed Bah

Fondateur, Kolonell

Passionate about digital and entrepreneurship in Africa, Mohamed has been helping Sénégalese businesses with their digital transformation since 2020. Founder of Kolonell, he believes every SME deserves a professional and accessible online présence.