Redirects namespace
Reference for resolving board-managed redirects.
A
JUse 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
1234board.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.
12345678910const 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:
| Field | Type | Behavior |
|---|---|---|
object | 'redirect_resolution' | Resource discriminator. |
path | string | The path Cavuno resolved. |
target | string | null | Board-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:
123import { 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.
Related methods
- Use
board.taxonomy.*.resolvefor canonical category, skill, place, and market slugs. Those methods returnredirectTofor taxonomy-specific 308s. - Use
safeRedirectPathfrom@cavuno/board/serverfor 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.