HTTPRedirect

HTTPRedirect[uri]

represents an HTTP redirect to the specified uri.

HTTPRedirect[uri,metadata]

represents an HTTP redirect to uri with the specified metadata.

Details

  • The redirect location uri can be either a string representing an explicit URL or a CloudObject.
  • HTTPRedirect is usually stored in a CloudObject or specified as the result in an APIFunction or FormFunction.
  • HTTPRedirect[] can be deployed to the cloud using CloudDeploy.
  • The metadata in HTTPRedirect is an association including the following possible elements:
  • "StatusCode"302HTTP status code
    "ContentType""text/html"MIME type for content
    "Cookies"{}cookies to set
    "Headers"Automatica list of rules giving HTTP response headers

Examples

open allclose all

Basic Examples  (1)

Redirect to a new URL:

In[1]:=
Click for copyable input
Out[1]=

Use inside APIFunction:

In[2]:=
Click for copyable input
Out[2]=

Use inside FormFunction:

In[3]:=
Click for copyable input
Out[3]=

Scope  (1)

Neat Examples  (1)

See Also

HTTPResponse  URLBuild  CloudDeploy  HTTPErrorResponse  FollowRedirects

Introduced in 2014
(10.0)