Skip to content

Script Development / Redirect DFF.REDIRECT

DFF.REDIRECT(...) is used to return an HTTP redirect response.

Parameter Type Required / Default Description
url str Required Redirect target URL
Example
1
2
3
@DFF.API('Redirect')
def go():
    return DFF.REDIRECT('https://example.com')

At runtime, non-ASCII characters in the URL are percent-encoded, but the scheme or target address is not validated. Use trusted absolute http:// / https:// URLs, or intentionally set application-relative paths.

Prevent Open Redirects

When user input is involved, the redirect target should come from trusted configuration or a strict allowlist; do not use arbitrary URLs from request parameters directly. Unless the business explicitly requires it and validation has been completed, also reject protocol-relative URLs and unexpected schemes.

When callers need JSON or error details, use DFF.RESP(...) instead of using browser redirects to express errors.