Skip to content

@xtandard/links/redirect

The redirect plane (ADR 0002, 0004): a web-standard handler that turns GET https://go.acme.com/{slug} into a redirect, records the click without waiting on the analytics sink, and serves deep-link association files, password and link-preview pages.

handle(request, ctx?) returns null when the request is not for a short link (unknown host, reserved path, outside basePath, or an unknown slug on a domain without notFoundUrl) so hosts can fall through to their own router; fetch always answers (the 404 page instead of null). Neither ever throws.

Edge-safe: no optional dependencies; pass ctx.waitUntil on Workers / Vercel so background writes outlive the response.

import { … } from "@xtandard/links/redirect";
Name Summary
createRedirectHandler Create the redirect handler.
Name Summary
RedirectContext Per-request runtime context (edge runtimes).
RedirectHandler The redirect handler.
RedirectHandlerOptions Options for createRedirectHandler.
Name Summary
RedirectPage Pages the handler renders itself.
Name Summary
DEFERRED_CLAIM_PATH Path (on a short domain, under basePath) of the deferred deep-link claim endpoint.