@agent-delivery-network/next
v0.1.1
Published
Fail-open Next.js middleware that forwards document requests to the ADN gateway.
Downloads
293
Maintainers
Readme
@agent-delivery-network/next
Fail-open Next.js / Vercel middleware that sends document requests to your ADN gateway. The gateway classifies traffic and returns content or x-adn-passthrough. Humans and uptime checks reach origin when the gateway says so, or on any error.
Source for review: github.com/agent-delivery-network/adn-next
npm install @agent-delivery-network/next// middleware.ts — env vars must be referenced here so Next.js inlines them at build time
import { createAdnMiddleware, config } from "@agent-delivery-network/next";
const adn = createAdnMiddleware({
gatewayUrl: process.env.ADN_GATEWAY_URL!,
siteToken: process.env.ADN_SITE_TOKEN!,
});
export function middleware(request: Request) {
return adn(request);
}
export { config };Set ADN_GATEWAY_URL and ADN_SITE_TOKEN in the host environment (Vercel project env, or .env.local). The connector sends x-adn-host from the incoming request hostname — do not set ADN_HOST.
Keep the exported config.matcher restrictive. Vercel bills middleware as Edge Requests; a matcher that includes .js / .css / images will inflate the bill.
Every failure mode (gateway down, slow, garbage, throw) fails open to origin.
