How to Integrate n8n with Cloudflare: Workers, R2, and KV

Cloudflare is more than just a CDN. With Workers, R2 storage, and KV cache, it is a serverless platform competing with AWS Lambda and S3. n8n integrates with all of it.

Why n8n + Cloudflare?

Cloudflare Workers are extremely fast and cheap. R2 has no egress fees (unlike S3). KV is great for caching API responses. Combining these with n8n workflows creates very efficient automations at low cost.

Cloudflare API Access

Generate an API token in your Cloudflare dashboard with appropriate permissions. In n8n, add it as an API credential. Use the HTTP Request node to call any Cloudflare API endpoint.

Top Use Cases

1. Workers as Webhook Endpoints

Cloudflare Workers receive webhooks at the edge (very fast) and forward to n8n. Useful when you need geographic routing or rate limiting before n8n processes.

2. R2 Storage Operations

Upload, download, and list objects in R2 buckets. Same API as S3 but no egress fees. Ideal for media-heavy workflows.

3. KV Cache

Cache expensive API responses in Cloudflare KV. Next time the workflow runs, fetch from cache (sub-millisecond) instead of re-calling the API. Saves money on rate-limited or paid APIs.

4. DNS Automation

Programmatically manage DNS records. Useful for white-label SaaS products that need to provision custom domains for customers.

5. Page Rules and Cache Purge

Trigger cache purges from your workflows when content updates. Set up page rules dynamically based on traffic patterns.

6. Security Events

Pull Cloudflare security events into n8n. Build alerts for unusual traffic patterns, attempted attacks, or rate limit violations.

Self-Hosting Behind Cloudflare

If you self-host n8n, Cloudflare in front of it adds: DDoS protection, free SSL, caching for static assets, and global CDN. n8n itself runs on your origin; Cloudflare handles the edge.

For setup, see my self-hosting guide.

Cost Considerations

Cloudflare’s free tier is generous. Workers: 100K requests/day free. R2: 10GB storage free. KV: 100K reads/day free. For most n8n workflows, you stay in the free tier.

Getting Started

If you do not have n8n yet, start your free trial here.

For more integrations, see my AWS integration and self-hosting guide.

Ready to automate?

Start your free n8n trial today.

Try n8n Free