Controller
isSafeRedirectUrl()
Signature
Section titled “Signature”isSafeRedirectUrl() — returns boolean
Available in: controller
Category: Miscellaneous Functions
Description
Section titled “Description”Returns true when redirectUrl stays on this site: a relative URL, or an absolute or
protocol-relative URL whose host is the current server. This is the same rule
redirectTo(url=…) applies before it redirects, so use it to check a return-to URL
(for example params.return_to) before storing it or building a link from it.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
redirectUrl | string | yes | — | The URL to check. |
serverName | string | no | [runtime expression] | The host to compare against. Defaults to the current request’s server name. |