跳转到内容
简体中文

redirect

此内容尚不支持你的语言。

redirect(url, status?): HttpResponse

Defined in: src/http/Route.ts:310

Redirect to a same-origin target — helper around Status.Found.

Only relative references pass (/dashboard, ../up, ?q=1, #top); an absolute URL, a protocol-relative //host target, or a control character throws HttpError(400). That default is the point: the target is very often a request parameter, and the ?next= pattern with no validation is the textbook open redirect — a phishing link bounces a freshly authenticated victim to a look-alike host (#125). A framework cannot force handlers to validate, so the helper they already reach for validates instead.

Use redirectExternal when leaving the origin is the intent.

string

number = Status.Found

HttpResponse