Skip to main content
If your site is on Cloudflare, the Dedica Cloudflare Worker is the quickest way to connect it. It serves /.well-known/dedica.json, sends a heartbeat every 5 minutes, fetches your policy, recognises agents and serves them content from Dedica. In report mode it passes everything through.

Before you start

In the Dedica dashboard, start onboarding and create a middleware token. Note the token and the site id.
The token is shown once. Store it as a secret. Once the middleware is connected, its token can’t be changed.

Install with one click

1

Deploy the worker

Click Deploy to Cloudflare on the middleware step in Dedica. Cloudflare copies the worker into your GitHub or GitLab account and asks for DEDICA_SITE_ID, DEDICA_API_URL and the DEDICA_MIDDLEWARE_TOKEN secret, then builds and deploys it.
2

Route your site through it

In the Cloudflare dashboard, add routes for the worker in front of your site: example.com/* and www.example.com/*. Make sure your DNS records are proxied (orange cloud).
3

Run the check

Back in Dedica, run the middleware check. The first heartbeat or policy fetch marks the worker live.

Install by hand

1

Get the code

Clone dedica-relay-cloudflare-worker and install its dependencies.
2

Configure and deploy

Set DEDICA_SITE_ID (and DEDICA_API_URL if needed) in wrangler.toml, then add the token as a secret and deploy.
3

Route and check

Add a route so the worker runs in front of your site, then run the middleware check in Dedica.

Configuration

Traffic reporting

From version 1.3.0, the worker reports every page load to Dedica, from people, AI agents and bots alike, so Dedica can show how much of your traffic is agents. Static files, the requests a page makes for images, scripts and data, and prefetches aren’t reported. Each report holds the time, method, host, path, status, response time, what the worker did, whether Dedica served it, the agent it recognised, the user agent, the referring page (origin and path only), the visitor’s country and a few request headers. It keeps only the attribution parameters of the URL (utm_source, utm_medium, utm_campaign, ref, source).
No IP address leaves your edge. A visitor is reported as a daily pseudonym made from their IP address, user agent, the day and a secret salt. Set your own salt with npx wrangler secret put DEDICA_SALT; otherwise the worker uses your middleware token, which Dedica only stores in hashed form. Cookies and your token are never sent.
Reports are sent in batches in the background, so they never slow down or change a response. If Dedica is briefly unavailable, the worker keeps the batch and sends it with the next one. See Report traffic for the format.

Check the worker

GET https://<your domain>/__dedica/status shows whether the worker is configured. It never shows secrets. The worker logs with the prefix [dedica]. Watch them with: