Edge Routing · Vercel

Add the NORG edge router to your Vercel middleware

For sites hosted on Vercel. No DNS change and no API token: one npm package, two environment variables and a redeploy.

What the middleware does

A person in a browserYour site, unchanged
Googlebot, Bingbot and other search crawlersYour site, unchanged (always; there is no setting for this)
A verified AI agent, page already rendered by NORGThe NORG render, at your own URL, with no redirect
A verified AI agent, page not rendered yetYour page stripped to its text, while NORG renders it

AI agents are verified by their IP address against the ranges their operators publish, using the client address Vercel itself records. It never breaks your site: if anything fails, or NORG cannot be reached, the request continues to your application exactly as if the package were not installed.

1

Get your keys and install the package

In NORG, open Publishing › CDN & Edge, choose Vercel and click Create Vercel install. You get a Site ID and a Site Key. The key is shown once, so copy it straight away. Then add the package to your project:

npm install @norg-ai/edge-router-vercel
# or: pnpm add @norg-ai/edge-router-vercel / yarn add @norg-ai/edge-router-vercel
2

Add the environment variables

In Vercel, open Project › Settings › Environment Variables and add both values for Production (and Preview if you want it there too). Mark NORG_SITE_KEY as Sensitive.

NORG_SITE_ID=your-site-id-from-norg
NORG_SITE_KEY=nek_live_your_site_key   # mark this one Sensitive in Vercel
3

Add the middleware and redeploy

For Next.js, put this in middleware.ts (Next.js 13–15) or proxy.ts (Next.js 16). The matcher skips static assets but still lets llms.txt, agents.md and /.well-known/mcp.json through, which NORG answers.

// middleware.ts (Next.js 13–15) or proxy.ts (Next.js 16), at the project root
import { withNorgEdge } from '@norg-ai/edge-router-vercel/next'

export default withNorgEdge()

export const config = {
  matcher: [
    '/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)',
    '/(api|trpc)(.*)',
  ],
}
// Already have a middleware? Wrap it: NORG runs first, then yours, unchanged.
import { clerkMiddleware } from '@clerk/nextjs/server'
import { withNorgEdge } from '@norg-ai/edge-router-vercel/next'

export default withNorgEdge(clerkMiddleware())

For any other framework on Vercel, use Vercel Routing Middleware:

// middleware.ts at the project root — Astro, SvelteKit, static, any Vercel project
import { createNorgEdge } from '@norg-ai/edge-router-vercel'

export default createNorgEdge()

Redeploy: Vercel applies new environment variables on the next deployment.

4

Verify

With your Site Key, the health probe answers with the middleware's status. It also tells NORG the install is running, so it shows as active within seconds.

curl -s -H "x-norg-edge-check: <your-site-key>" https://your-site.example/ | head -c 200
# {"site_id":"…","version":"0.1.0","env":"production","platform":"vercel","entitled":true,…}

A normal visit gets your site with no NORG header:

curl -sI https://your-site.example/some-page/ | grep -i x-norg-edge
# no output: people get your site unchanged

Updates and switching off

Updates arrive like any other dependency: bump @norg-ai/edge-router-vercel and redeploy. NORG shows when a newer version is available. To switch it off, set this variable and redeploy, or remove the middleware:

NORG_EDGE_DISABLED=true   # then redeploy: every visitor gets your normal site

Using Cloudflare in front of Vercel? The Cloudflare Worker install works there too.