How to enable Route for default workers.dev when deploying Workers Script via API
I am considering deploying Workers Script using the API in the link below.
https://developers.cloudflare.com/api/operations/worker-script-upload-worker-module
The deployment itself is successful, but when I check Settings>Triggers>Routes of the deployed Script, [subdomain].workers.dev, which is normally set up & enabled automatically, is disabled.
https://developers.cloudflare.com/workers/configuration/routing/routes/#routes-with-workersdev
I would like to use workers.dev Routes even when deployed by Script via API.
I would like to know how to enable “workers.dev" Routes via API or if there is another more appropriate policy.
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
Cloudflare Docs
Routes · Cloudflare Workers docs
Routes allow users to map a URL pattern to a Worker. When a request comes in to the Cloudflare network that matches the specified URL pattern, your …
4 Replies
It is not publicly documented on how to enable it. You would have to reverse engineer the wrangler code to find out.
Oh, I see... I'll check GitHub. Does anyone else know about this?
I've resolved!
I can enable default *.workers.dev route by below API request.
I found this on wlanger.
https://github.com/cloudflare/workers-sdk/blob/main/packages/wrangler/src/triggers/deploy.ts#L107
GitHub
workers-sdk/packages/wrangler/src/triggers/deploy.ts at main · clou...
⛅️ Home to Wrangler, the CLI for Cloudflare Workers® - cloudflare/workers-sdk
this is not documented.