TL;DR
- Cloudflare = mạng lưới CDN + bảo mật + edge computing lớn nhất thế giới — và free cho 95% use case SMB.
- Setup chỉ cần đổi nameserver, không touch code, 15 phút xong.
- 5 lợi ích chính: tăng tốc 30-70%, chặn DDoS, SSL miễn phí, analytics, Workers serverless.
- Hơn 80% website D-Solutions deploy đều dùng Cloudflare.
Cloudflare làm gì?
1. CDN (Content Delivery Network)
Cloudflare có 310+ data center trên 120+ quốc gia, có data center tại Hà Nội + TP.HCM.
Khi user từ Việt Nam load site bạn (host ở Singapore):
- Không có CDN: Request đi Singapore → trả về VN, latency 50-150ms.
- Có Cloudflare: Request hit Cloudflare HN/HCM cache, latency 5-20ms.
Kết quả: site load nhanh 30-70% tùy content.
2. DDoS Protection
Cloudflare chặn DDoS attack tự động — kể cả tier free. Mạng họ xử lý attack lớn nhất lịch sử (40+ Tbps).
Doanh nghiệp Việt nhiều khi bị attack từ competitor → site sập 2-3 ngày. Cloudflare loại bỏ rủi ro này.
3. SSL miễn phí (HTTPS)
Trước Let’s Encrypt (2016), SSL cert tốn $50-200/năm. Cloudflare có SSL miễn phí từ 2014 — vẫn miễn phí 2026.
Auto-renew, không cần lo expire.
4. Web Application Firewall (WAF)
Chặn SQL injection, XSS, brute force, bot scrape — tự động.
Tier free: basic rules. Tier Pro ($20/tháng): custom rules + Bot Management.
5. Analytics + Insights
Real-time analytics: requests, bandwidth, threats blocked, cache hit rate. Đầy đủ hơn Google Analytics cho metric server-level.
Các sản phẩm Cloudflare quan trọng
Cloudflare Pages (FREE)
Static site hosting. Deploy bằng git push. Bandwidth unlimited.
Phù hợp: portfolio, marketing site, Astro/Next.js/SvelteKit apps. (Site D-Solutions chính đang chạy trên đây.)
Cloudflare Workers (Free tier: 100K req/day)
Serverless functions chạy edge — latency < 50ms global. JavaScript hoặc TypeScript.
Phù hợp: API endpoints, CORS proxy, image transformation, auth middleware.
Cloudflare R2 (Free tier: 10GB storage)
S3-compatible object storage. Không có egress fee (S3 tính $0.09/GB egress → R2 = $0).
Phù hợp: ảnh sản phẩm, file download, video, backup.
Cloudflare D1 (Free tier: 5GB)
Serverless SQLite database trên edge. Đọc nhanh global.
Phù hợp: low-write apps, blogs, configs.
Cloudflare KV (Free tier: 100K read/day)
Key-value store global. Latency 10-20ms.
Phù hợp: session, cache, feature flags, A/B test variants.
Cloudflare Tunnel (FREE)
Expose local server lên internet không cần public IP, không cần port forward. Secure.
Phù hợp: dev environment, internal tools, remote access server WordPress.
Setup Cloudflare miễn phí trong 15 phút
Bước 1: Đăng ký account (3 phút)
- Vào cloudflare.com, sign up free
- Verify email
Bước 2: Add site (2 phút)
- Click “Add a Site”, nhập domain
- Chọn plan Free
- Cloudflare scan DNS records hiện tại
Bước 3: Verify DNS (2 phút)
- Cloudflare hiển thị DNS records → verify đúng
- Cờ proxy (orange cloud) bật cho A/CNAME chính
Bước 4: Đổi nameserver (5 phút)
- Cloudflare cho 2 nameserver mới (vd:
nina.ns.cloudflare.com) - Vào nhà cung cấp domain (Mat Bao, Tenten, Namecheap…) → update nameserver
- Wait 5-60 phút DNS propagate
Bước 5: Tinh chỉnh setting (3 phút)
- SSL/TLS: Full (Strict) nếu hosting có cert
- Speed → Auto Minify: bật HTML, CSS, JS
- Caching → Browser TTL: 4 hours
- Page Rules: cache HTML cho landing pages
Xong. Site bây giờ nhanh hơn, an toàn hơn, miễn phí.
Common pitfalls
1. Tắt proxy mà không biết
Orange cloud (proxy) = qua Cloudflare. Grey cloud = bypass.
Lý do người ta tắt: SSH/email không qua được Cloudflare (Cloudflare chỉ proxy HTTP/HTTPS).
→ Tắt proxy CHO subdomain riêng (vd: ssh.example.com) thay vì cho A record chính.
2. Cache HTML quá aggressive
Cache 1 năm cho HTML → user thấy nội dung cũ.
→ Cache HTML 30 phút - 4 giờ. Cache static assets (CSS, JS, hình) 30 ngày - 1 năm.
3. Mixed content (HTTPS + HTTP)
Site HTTPS nhưng link image/script http:// → browser block.
→ Bật “Automatic HTTPS Rewrites” trong Cloudflare → auto fix.
4. Origin server không setup đúng
User → Cloudflare HTTPS → Origin HTTP → SSL “Flexible” → vẫn hoạt động nhưng không secure.
→ Setup origin server có SSL (Let’s Encrypt). Đổi Cloudflare SSL mode về “Full (Strict)“.
5. Bị block từ Cloudflare cho user thật
WAF rules quá strict → block legit user. Đặc biệt với pattern URL phức tạp.
→ Check “Security Events” trong Cloudflare dashboard. Whitelist nếu cần.
Khi nào CẦN trả phí Cloudflare?
Pro ($20/tháng) khi:
- Cần Image Optimization (auto resize, format conversion)
- Cần advanced WAF rules
- Cần SLA uptime guarantee
Business ($200/tháng) khi:
- SaaS bán custom domain cho khách (SSL for SaaS)
- Cần 100% uptime SLA
- Compliance PCI-DSS
Enterprise (custom) khi: scale > 1M req/day, cần dedicated support.
90% DN Việt SMB: tier Free là đủ.
Cloudflare vs alternatives
| Feature | Cloudflare Free | AWS CloudFront | BunnyCDN |
|---|---|---|---|
| Pricing | Free unlimited | Pay per GB | $0.01/GB |
| Edge locations | 310+ | 600+ | 100+ |
| DDoS protection | Unlimited | Pay extra | Basic |
| SSL | Free | Free | Free |
| Workers/Functions | Yes | Yes (Lambda@Edge) | No |
| Setup difficulty | Easy | Hard | Easy |
| VN data center | Yes | Yes (HCM) | Yes |
Verdict: Cloudflare best cho 90% case. AWS hợp enterprise đã có ecosystem AWS. BunnyCDN giá tốt cho heavy bandwidth.
Kết luận
Cloudflare là một trong những free service value nhất cho web/business 2026. Setup 15 phút → tăng tốc 30-70%, security tốt hơn, analytics tốt hơn, hoàn toàn free.
Lý do duy nhất KHÔNG dùng: bạn đã có infrastructure riêng + team DevOps, cần control hoàn toàn.
D-Solutions deploy 80%+ project trên Cloudflare. Cần hỗ trợ migrate hoặc setup tối ưu? Xem Dịch vụ Bảo trì Web.