Get your SITE_ID and NORG_SITE_KEY
The worker needs two values that tie it to your NORG site. Get them before you start, because the install asks for both.
- SITE_ID: identifies your site in NORG. It is not secret.
- NORG_SITE_KEY: the secret the worker uses to talk to NORG. It is shown once. NORG stores only a hash, so copy it straight away.
Option A: ask your AI assistant (NORG MCP)
With the NORG connector, ask for the edge site's status. It returns the SITE_ID. Then ask it to rotate the site key to mint a fresh NORG_SITE_KEY. Rotating asks you to confirm first: reply yes, and the new key is shown once.
If the site does not exist yet, ask it to convert the workspace to Sitemap Mirror mode for your domain. That creates the site and starts the first crawl. The Deploy button never changes the site's mode, it only deploys the worker. Free workspaces mirror up to 10 pages, and the cap cannot be raised once the site exists, so say so if you want the full mirror.
Option B: have NORG provide them
Ask your NORG contact. We will send the SITE_ID and a freshly minted NORG_SITE_KEY.
Rotating later: rotating invalidates the old key at once. A worker already running starts getting 401 responses from NORG until you put the new key into its secret and redeploy. It never breaks your site in the meantime: the worker falls back to serving your pages unchanged.
Connect GitHub (first time only)
Under Create an app, Cloudflare asks for a Git account. It creates a repository in that account and deploys from it. Click New GitHub connection. (GitLab works the same way.)

GitHub asks you to authorize Cloudflare Workers and Pages. Click Authorize.

Then choose Only select repositories. GitHub insists on at least one, so pick any existing repository: Cloudflare does not touch it. Click Install & Authorize. Cloudflare creates the new repository for your worker itself and adds it to its own access list. Afterwards you can remove the repository you picked under GitHub Settings, Applications, Cloudflare Workers and Pages, Configure. If you have no repositories at all, create an empty one first.

Cloudflare may drop you back at the start. If so, choose Clone a public repository via Git URL, paste https://github.com/norgai/norg-edge-mirror-cloudflare-deploy and click Next.

Fill in Set up your application
You may need to re-enter SITE_ID and NORG_SITE_KEY, and pick your Git connection from the dropdown. Then work down the form:




- Git account
- The GitHub or GitLab connection Cloudflare uses to create a repository for your worker. Every push to its production branch redeploys the worker.
- → Pick the connection you just made.
- Create private Git repository
- Whether the repository Cloudflare creates for you is private.
- → Tick it. Nothing in the repository needs to be public.
- Project name
- The worker's name. It must be unique in your Cloudflare account.
- → Keep norg-edge-router, or add your site, such as norg-edge-router-example. Installing on a second site needs a different name.
- NORG_SITE_KEY
- The secret that authenticates the worker to NORG. The box is masked.
- → Paste the key from step 1.
- SITE_ID
- Your NORG site identifier. It starts as the placeholder REPLACE_WITH_SITE_ID.
- → Replace the placeholder with your SITE_ID from step 1.
- Build command
- Runs in Cloudflare before deploying. It prepares the worker file.
- → Leave as npm run build.
- Deploy command
- Publishes the worker to your account.
- → Leave as npm run deploy.
- Preview command
- Used for preview builds of other branches.
- → Leave as npx wrangler preview.
- Enable Preview builds
- Builds branches other than production into previews.
- → Leave at the default.
- Protect with Cloudflare Access
- Puts a Cloudflare login in front of preview URLs.
- → Leave off.
- Advanced settings
- Root directory, build variables and similar.
- → Leave alone.
Click Deploy.
Wait for the build

Cloudflare sets up the repository, then builds and deploys. It takes about half a minute. A green build means the worker is live in your account.

The worker has no traffic yet: Domains, Workers and Bindings all read 0. The next step attaches it.

Attach the worker to your hostname
Deploying does not send any traffic to the worker. You attach it yourself. The hostname must be proxied (orange cloud) in Cloudflare DNS, or the worker never runs.
Open the worker, then Domains and Add Route. Choose the Zone and enter the Route as your hostname followed by /*, for example www.example.com/*. Click Add Route.


Mirroring a whole subdomain space rather than one hostname? Use Add Domain (a custom domain) instead of a route.

Failed to add domain? Another Worker is probably already using that route or domain, so they conflict. Find it under the zone's Workers Routes, then remove it or point it somewhere else. If your own Worker must keep serving the hostname, see installing alongside your own Worker.

Add route exclusions
Static assets such as scripts, styles and images do not need the worker. An exclusion is a Cloudflare route that points at no worker, so requests to those paths skip it. NORG cannot add exclusions for this install because it holds no Cloudflare token, so you add them yourself.
- Open your zone, then Workers Routes and Add route.
- Enter a path prefix as the Route, for example
www.example.com/_next/*. - Open the Worker dropdown and choose None, then Save.
- Repeat for each prefix your site serves assets from, such as
/_next/*,/_vercel/*or/static/*.


Check the list afterwards: every exclusion should read Workers are disabled on this route, next to your one hostname/* route that names the worker.

Test that it works
1. The normal site. Open your site in a browser. It must look and behave exactly as before.

2. The AI mirror. Add ?agent=true to the address, for example https://www.example.com/?agent=true. It should load the NORG AI-optimised version of the page. If it still shows your normal page, the worker is not on the route yet: recheck the route and that the hostname is proxied.
3. Invocations. Back in Cloudflare, open Workers & Pages, then your worker. The Invocations tile should now be above zero and rise as you reload the page. That confirms what you saw in the browser.

Turn on observability
Open the worker's Observability tab and click Enable Observability. Logs then show every request the worker handles, which is the quickest way to see what it is doing.

- Free plan: we recommend enabling it. There is a daily cap on logs, and events past it are dropped rather than billed.
- Paid plan: enable it, but watch the cost. Each request is a log event and logs beyond the plan's allowance are billed, so a busy site adds up. Lower the sampling rate to cap it, and check Cloudflare's current Workers pricing.
- Switch it off once the install has run smoothly for about a month. The worker keeps working without logging.

