Redirects namespace

Reference for resolving board-managed redirects.

Use board.redirects in your public catch-all or not-found path. Ask Cavuno for a board-managed redirect before returning a real 404, then emit a permanent 308 when a target exists.

Shared behavior

The method is a public read. It returns the Board API wire body unchanged and throws BoardApiError for a non-2xx response. Its trailing FetchOptions passes abort signals, headers, and framework cache directives through to fetch.

board.redirects.resolve

ts
board.redirects.resolve(
path: string,
options?: FetchOptions,
): Promise<RedirectResolution>

path is the board-relative public path to resolve, including its leading slash. The SDK sends it as the URL-encoded path query parameter.

ts
const resolution = await board.redirects.resolve('/old-jobs');
if (resolution.target) {
return new Response(null, {
status: 308,
headers: { location: resolution.target },
});
}
return new Response('Not found', { status: 404 });

RedirectResolution contains:

FieldTypeBehavior
object'redirect_resolution'Resource discriminator.
pathstringThe path Cavuno resolved.
targetstring | nullBoard-relative redirect target, or null when no rule matches.

A successful API request always returns the resolution object. target: null is the expected “no managed redirect” result and should lead to your application’s 404; it is not an API error.

Safety and errors

Call this method only for a route that did not resolve normally. Do not redirect every request through the lookup, and do not turn target: null into a redirect loop.

The API contract returns a board-relative target. If you also accept user-controlled next or redirect parameters elsewhere, validate those separately with the server helper:

ts
import { safeRedirectPath } from '@cavuno/board/server';
const returnPath = safeRedirectPath(url.searchParams.get('next'), '/');

A missing or private board throws BoardApiError with status 404. Preserve that distinction in logs with error.code and error.requestId, but return the same public not-found experience unless your application has a reason to expose it.

  • Use board.taxonomy.*.resolve for canonical category, skill, place, and market slugs. Those methods return redirectTo for taxonomy-specific 308s.
  • Use safeRedirectPath from @cavuno/board/server for user-supplied return paths; it is separate from board-managed redirect resolution.
  • See Paths and redirects for route-handler placement and redirect-before-404 sequencing.