[]previous and next page

resolveRedirectTarget

Like checkRedirectTarget, but throws.

Like checkRedirectTarget, but throws.

Import#

ts
import { resolveRedirectTarget } from "@shadow-js/dusk/server";

Signature#

ts
function resolveRedirectTarget(target: string, policy: RedirectPolicy): string

Parameters#

Name Description
target The target.
policy Own origin and trusted origins.

Returns#

The same target, safe for Location.

Throws#

  • RedirectBlockedError for a target that is not allowed.

Examples#

ts
resolveRedirectTarget("/login", { origin: "https://app.example", trustedOrigins: new Set() });