workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

🔥 Request: Support for 1000+ Multi-Zone Worker Routes (Avoid /zones Rate Limits)

Open sclass opened this issue 1 month ago • 1 comments

Describe the solution

I am deploying a Worker that needs to serve traffic for over 1,000 domains. (🌐 SPACE-SCALE Deploy: Need Support for 1000+ Worker Routes)

Originally, I attempted to configure two route patterns per domain:

.domain/

domain/*

This resulted in 2,000+ routes, and Wrangler consistently failed due to API rate limits during deployment.

To reduce complexity, I switched to using one route per domain (domain/*), bringing the total down to around 1,000+ routes. However, even with this reduced set, Wrangler still fails with:

/zones → 10500: More than 1200 requests per 300 seconds

/zones/:id/workers/routes → 10429: Rate limited

My use case is legitimate: This is a large multi-domain platform where all domains belong to one organization, and the Worker needs to handle template rendering + shared backend logic for all zones.

My Question

Is there an officially recommended method for deploying a Worker to 1000+ zones?

Possible approaches I am wondering about:

Bulk route creation instead of one API call per zone

Local zone_id caching to avoid repeated /zones lookups

A higher rate limit for valid large-scale deployments

A Worker SaaS-style configuration that reduces the number of required routes

Any guidance or best practices for deployments at this scale would be extremely helpful.

(⚡ SCLASS Multi-Domain Worker: Bulk Route Deploy Needed)

Thank you.

sclass avatar Dec 07 '25 11:12 sclass

@sclass to help debug this, could you clarify what permissions your auth token has? Wrangler has two methods for updating routes: bulk, and per-zone. We only use the per-zone method if the API token doesn't have the "All Zones" permission. You should be able to check this by looking for a message in Wrangler's output like this:

Falling back to using the zone-based API endpoint to update each route individually

If that token is set correctly, and each route has a zone_id field set, Wrangler should make many fewer API calls.

Altenratively, you can manage routes entirely outside of Wrangler via the dashboard/API by removing any route and routes keys from your config, and adding workers_dev = false.

penalosa avatar Dec 08 '25 14:12 penalosa