Cloudflare worker for n8n proxy
- You can use this service to protect your n8n instance from DDoS attacks.
- You can use this service to hide your n8n instance from the public.
- You can use this service to add rate limiting to your n8n instance.
- You can use this service to add deduplication to your n8n instance.
- You can use this service to add a queue to your n8n instance.
- You can use this service to add a retry mechanism to your n8n instance.
- You need a paid Worker plan ($5 USD) for this service due to the queue.
- A cloudflare domain
cloudflare -> cloudflare worker -> n8n
npm install -g wrangler pnpm
pnpm install
wrangler login
cp wrangler.toml_example wrangler.toml
- Change everywhere
example.com
to your domain
wrangler queues create cf-n8n-proxy-production -e production
wrangler queues create dlq-cf-n8n-proxy-production -e production
wrangler kv:namespace create cf-n8n-proxy
- Replace
<mykvid>
with the response ID in the wrangler.toml file. - Change
DEDUPLICATION_ENABLED=false
toDEDUPLICATION_ENABLED=true
in the wrangler.toml file.
IMPORTANT NOTES ABOUT DEDUPLICATION "As of January 2022, expiration targets that are less than 60 seconds into the future are not supported. This is true for both expiration methods."
DEDUPLICATION_TTL
is optional; by default, it is set to 60 seconds.
- Change
RATE_LIMITING_ENABLED=false
toRATE_LIMITING_ENABLED=true
in the wrangler.toml file.
simple = { limit = 100, period = 60 }
wrangler deploy -e production
wrangler dev