HTTP::is_redirect

Description

Returns a true value if the response is a redirect. Since only responses can be redirects, it does not make sense to use this command in a clientside event.

Syntax

HTTP::is_redirect

HTTP::is_redirect

  • Returns a true value if the response is a redirect. Note that status codes 300 and 304 are not considered redirects by this command. This command is synonymous with HTTP::header is_redirect.

  • The following response codes cause HTTP::is_redirect to return a match (and all include a Location header directing the browser to an alternate resource):

  • 301 (Moved Permanently)
  • 302 (Found)
  • 303 (See Other)
  • 305 (Use Proxy)
  • 307 (Temporary Redirect)

Note: For pre-9.2.0 versions you can use HTTP::header is_redirect for the same purpose.

Examples

when HTTP_RESPONSE {
  if { [HTTP::is_redirect] } {
    log local0. "Request redirected."
  }
}