Edge Routing · Cloudflare

Install on Cloudflare with the Deploy button

One click builds the NORG edge router in your own Cloudflare account from our public repository. Nine steps, about fifteen minutes.

1

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.

2

Click Deploy to Cloudflare and pick the account

Open the NORG repository README and click Deploy to Cloudflare. Sign in to Cloudflare if asked.

The Deploy to Cloudflare button in the repository README
Click Deploy to Cloudflare in the README.

If you have more than one account, Cloudflare asks which to use. Choose the account that holds the zone for your domain. The worker can only attach to zones in the account it is deployed to.

Cloudflare account picker
Pick the account that owns the zone you are mirroring.
3

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.)

Set up your application: Git account
Connect GitHub (or GitLab). Cloudflare creates the repository for you.

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

GitHub asking to authorize Cloudflare Workers and Pages
GitHub step 1: 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.

GitHub repository access choice
GitHub step 2: choose Only select repositories, pick any one repository, then Install & Authorize.

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.

Clone a public repository via Git URL
Paste the NORG repository URL and click Next.
4

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 dropdown
Back on the form, choose your new connection in the Git account dropdown.
Project name, NORG_SITE_KEY and SITE_ID fields
Project name, then your NORG_SITE_KEY and SITE_ID.
Build, deploy and preview commands
Leave the three commands as they are.
Preview builds and Cloudflare Access toggles
Leave the preview and Access toggles at their defaults.
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.

5

Wait for the build

Setting up your repository
Cloudflare creates the repository. This takes a few seconds.

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.

Successful build
A green build with Build, Deploy and Deploying all ticked.

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

Worker overview with no domains or routes
The new worker. It is deployed but attached to no traffic yet.
6

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.

Domains tab with Add Route highlighted
Domains tab, then Add Route.
Add Route dialog
Choose the zone and enter your hostname followed by /*.

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

Failed to add domain error
Failed to add domain: see the checks below.

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.

Route listed under Custom Domains and Routes
The route now lists against the worker.
7

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.

  1. Open your zone, then Workers Routes and Add route.
  2. Enter a path prefix as the Route, for example www.example.com/_next/*.
  3. Open the Worker dropdown and choose None, then Save.
  4. Repeat for each prefix your site serves assets from, such as /_next/*, /_vercel/* or /static/*.
Zone Workers Routes page with Add route highlighted
Zone, Workers Routes, Add route.
Add route dialog for an exclusion
Enter the excluded path, then open the Worker dropdown and choose None.

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

Dashboard quick search for Workers & Pages
Ctrl/Cmd K, type Workers, pick Workers & Pages to get back to your worker.
8

Test that it works

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

The customer site loading normally
A normal browser visit looks 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.

Worker overview showing invocations
Invocations counts the requests the worker has handled.
9

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.

Observability tab with Enable Observability
Observability tab, then Enable Observability.
  • 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.