> ## Documentation Index
> Fetch the complete documentation index at: https://docs.epode.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Activate AXG at the edge

> Preview and activate temporal freshness plus closed task intent on Cloudflare, Vercel, AWS CloudFront, or a self-hosted Node server.

The AXG edge adapter is the managed content path for public blogs, guides, and
documentation. It leaves the customer's useful page intact and adds only
publisher-approved temporal and task-guide navigation:

* one stale article can carry a fixed one-year calendar-date index (or a legacy
  ISO-week index);
* the selected date resolves in one hop to the applicable immutable edition;
* a current edition can expose a closed set of task guides; and
* a selected guide can emit bounded task-intent evidence without retaining a
  prompt, response, cookie, IP address, or full user agent.

This is a delivery mechanism, not evidence that a provider escaped a proprietary
cache or that AEO results improved. Measure answer behavior separately before
and after activation.

## Required safety contract

Every install must have:

* a different HTTPS upstream origin so the edge cannot recurse;
* explicit include paths and narrower provider route bindings;
* an isolated provider preview and no-store preview responses;
* no forwarding of caller cookies or authorization;
* streaming enforcement of the decoded one-megabyte response limit;
* a bounded one-hour-or-less resolver cache policy;
* an immutable manifest revision and provider deployment version;
* a tested disabled mode and provider-native rollback; and
* a closed intent schema with attribution explicitly not established.

## Provider paths

<CardGroup cols={2}>
  <Card title="Cloudflare Workers" icon="cloud">
    Bind a Worker Route only to the approved path. Upload a preview version,
    verify it, then promote or roll back to a previous Worker version.
  </Card>

  <Card title="Vercel" icon="triangle">
    Use Routing Middleware with a narrow matcher. Verify a preview deployment,
    then promote that exact deployment or roll the alias back.
  </Card>

  <Card title="AWS CloudFront" icon="aws">
    Use a numbered Lambda\@Edge origin-request version on a staging distribution.
    Origin-response triggers cannot read and transform the upstream body.
  </Card>

  <Card title="Self-hosted Node" icon="server">
    Embed `@epode/node/axg-node` middleware in an existing Express or Node
    HTTP application, or run the standalone proxy in front of any origin.
  </Card>
</CardGroup>

## Preview, activate, and reverse

`disabled` passes through upstream content. `preview` transforms only requests
with the exact `Epode-AXG-Preview` secret header and makes the response private.
`active` transforms eligible requests from recognized AI traffic in the
approved path and leaves `X-Epode-AXG-Revision` and `X-Epode-AXG-Audience`
response headers for auditing. Configuring the preview token alongside `active`
lets a human tester send the preview header to see the exact agent variant.

Cloudflare and Vercel use the private AXG preview header. CloudFront instead
runs an `active` bundle only on a staging distribution and uses an
`aws-cf-cd-...` continuous-deployment header to route approved requests there.
Intent-choice responses are always private and no-store so a selected task is
not replayed from a shared cache. Safe fail-open responses include only a
bounded `X-Epode-AXG-Fallback` stage, never an exception or secret.

Before activation, verify the original page, every date resolver, every task
choice, excluded paths, unsafe methods, origin failure, and intent-sink failure.
Then promote the exact tested provider version. A rollback must restore native
origin bytes, not merely hide the injected navigation in CSS or JavaScript.

## AI-traffic gating and content parity

Injected navigation reaches only declared AI traffic. The runtime classifies
the request's User-Agent against the documented first-party tokens (GPTBot,
OAI-SearchBot, ChatGPT-User, ClaudeBot, Claude-SearchBot, Claude-User,
PerplexityBot, Perplexity-User, and Google's AI fetchers). A matching token is
spoofable and is therefore only a claim: it widens what a response advertises,
never what a caller is authorized to do.

Everything else — human browsers, unknown clients, and deliberately the classic
search indexers Googlebot, GoogleOther, and bingbot — receives the page
byte-identical to the upstream origin. That parity is the cloaking stance:
what ranks the page in a classic index is exactly what a human sees, and the
agent variant only ever adds publisher-authored navigation on top of the same
underlying content, publicly documented here and in the protocol. Never place
answer facts, prices, or claims in the injected navigation that the human page
does not carry.

Explicit graph URLs — `/_epode/` freshness and answer routes, date resolvers,
and task-guide pages — still render their content for every audience, so a URL
an agent cited stays shareable with humans. They render without the index
navigation, and bounded task-intent evidence is retained only for the
recognized-agent audience, never from a human visit to a shared link.

Because one URL now serves two representations, every transformed or relayed
in-scope response carries `Vary: User-Agent`. Cloudflare Workers and Vercel
Middleware run before their shared caches, so the origin body may cache
normally while injection happens per request. On CloudFront, the Lambda\@Edge
generated response is cached by the distribution: include the `User-Agent`
header in the cache policy key (or disable caching on the AXG behavior) so an
agent variant is never served to a human, or the reverse. A self-hosted Node
deployment usually has no shared cache in front; if you add one, apply the
same `User-Agent` cache-key rule.

## Self-hosted Node

Hosts without a programmable CDN edge — an Express app on a VM, a container
platform, or an internal reverse proxy — install the same runtime through
`@epode/node/axg-node`. The embedded middleware hands everything except a
recognized transform to the application untouched, so human traffic, unsafe
methods, and out-of-scope paths keep byte-identical native behavior, and the
raw content for a transform is fetched back from the same application over a
loopback subrequest that carries a per-process recursion guard:

```ts theme={null}
import { createAxgEdgeRuntime } from "@epode/node/axg-edge";
import { createNodeAxgMiddleware, createSelfUpstream } from "@epode/node/axg-node";

const selfUpstream = createSelfUpstream({ port: 3000 });
const runtime = createAxgEdgeRuntime({
  manifest,                                   // dashboard-exported manifest
  upstreamOrigin: selfUpstream.upstreamOrigin,
  mode: "preview",                            // then "active"; "disabled" rolls back
  previewToken: process.env.AXG_PREVIEW_TOKEN,
  fetch: selfUpstream.fetch,
});
app.use(createNodeAxgMiddleware(runtime));    // before the app's own routes
```

`createNodeAxgHandler(runtime)` instead runs a dedicated proxy process in
front of a separate HTTPS upstream origin — the same contract as the CDN
adapters. Rollback is configuration: redeploy with `mode: "disabled"` (or
remove the middleware) and the application serves its native bytes again. A
failed loopback subrequest answers 502 with `private, no-store`; it never
falls through to the stale native page for a recognized agent, and never
leaks an exception.

Agentic browsers that present an ordinary browser User-Agent (operator-style
browsing, extensions driving a real Chrome) are indistinguishable from humans
by design and receive the human page. Do not compensate with UA-resemblance
heuristics; if a provider ships a verifiable identity signal such as Web Bot
Auth, prefer verifying it over widening the token roster.

[Run the multicloud AXG edge example](https://github.com/open-software-network/os-epode/tree/main/examples/axg-edge-multicloud)
