@d3-inc/d3-edge-vercel-middleware
v0.1.0
Published
Vercel Routing Middleware adapter for D3 Edge bot-auth enforcement: extract → policy decision → pass/block, fail-open.
Keywords
Readme
@d3-inc/d3-edge-vercel-middleware
Vercel Routing Middleware adapter for D3 Edge bot-auth enforcement. On every request it extracts the signature headers, user agent, and IP, asks your D3 Edge policy endpoint for a decision, and passes or blocks accordingly — failing open if the policy call errors or times out, so an outage never takes down your site.
Install
npm i @d3-inc/d3-edge-vercel-middlewareUsage
// middleware.ts (project root)
import { createD3Middleware, config } from '@d3-inc/d3-edge-vercel-middleware';
export default createD3Middleware();
export { config };Set two project environment variables (from your D3 Edge dashboard's install page):
| Variable | Value |
| -------------------- | ------------------------------------- |
| POLICY_WORKER_URL | https://edge-api.d3.com/v1/decision |
| POLICY_ADAPTER_KEY | Your org's adapter key (d3_k_…) |
Leave POLICY_WORKER_URL unset for pure passthrough (no enforcement, no
reporting) — useful for staging the rollout.
Docs
Full documentation, including config options and the decision model: ai.d3.com/docs.
License
Apache-2.0
