create a worker through dashboard at same host & url as a sveltekit cloudflare Pages app
I have a pages sveltekit app. I want to create a worker for rezising images, but can't get it running inside the app. I therefore want to create a separately worker using Cloudflare Workers, talk to it through an API inside my sveltekit app. I want to create the worker script through the CF dashboard.
My quest is, how can I host that worker at the same host / domain / URL as my svelte pages app? And put it at /image-resizing, for example, under root.
Instead of at a separate domain, which is where im getting directed by following the "create worker" button at Cf dashboard
2 Replies
You can just use Worker Routes: https://developers.cloudflare.com/workers/configuration/routing/routes/
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 Worker will execute on that route.
as long as your root cname to pages.dev is proxied