I have a (non-static) website foo.com deployed to render.com.
I proxy to it via CF (A record for foo.com pointing to render ip, CNAME for www.foo.com to render domain).
I want a worker that runs for just a foo.com/path*
I tried the obvious way to configure it in wrangler.toml:
route = { pattern = "foo.com/path*, zone_id = “my-zone-id” }
But the worker is not executed. It is executed on workers.dev domain so it’s there.
The route shows up in /workers tab in dashboard.
The way I read Routes · Cloudflare Workers docs it should just work, but it doesn’t.
Is such a setup supported?
If yes, what have I missed in my config? How can I debug this?
That looks fine, can you share your code and config?
Thanks for response.
Here’s my complete setup:
s3proxy.dev is hosted on render, proxied via CF.
My wrangler.toml
:
name = "upload-s3"
main = "src/index.js"
compatibility_date = "2023-01-21"
workers_dev = true
# route = { pattern = "s3proxy.dev/upload*", zone_name = "s3proxy.dev" }
route = { pattern = "s3proxy.dev/upload*", zone_id = "f227b44842e4b35fb1b4607ceb7838ba" }
This is straight from Configuration · Cloudflare Workers docs
I tried both zone_name and zone_id.
I tried with both workers_dev = true and false.
I tried with route s3proxy.dev/*
My worker at the moment is the simplest thing possible:
export default {
async fetch(request, env, ctx) {
return new Response("Hello World!");
},
};
Given those I would expect going to https://s3proxy.dev/uploadit would trigger the worker and displlay Hello world
in the browser.
But the worker just doesn’t seem to be invoked.
The route shows in the ui:
The worker works on cf domain: https://upload-s3.kjk.workers.dev/
Worker seems to be configured properly:
This is all the most basic setup, following the docs.
It works when I setup worker on a custom domain.
So my theory is that in this DNS setup somehow causes the worker to not trigger the worker but there’s nothing in the docs suggesting such limitations.