Product Documentation

Expressions for HTTP Status Codes and Numeric HTTP Payload Data Other Than Dates

Aug 31, 2016

The following table describes prefixes for numeric values in HTTP data other than dates.

Table 1. Prefixes That Evaluate HTTP Request or Response Length

Prefix

Description

HTTP.REQ.CONTENT_LENGTH

Returns the length of an HTTP request as a number.

Following is an example:

http.req.content_length < 500

HTTP.RES.CONTENT_LENGTH

Returns the length of the HTTP response as a number.

Following is an example:

http.res.content_length <= 1000

HTTP.RES.STATUS

Returns the response status code

HTTP.RES.IS_REDIRECT

Returns a Boolean TRUE if the response code is associated with a redirect. Following are the redirect response codes:
  • 300 (Multiple Choices)
  • 301 (Moved Permanently)
  • 302 (Found)
  • 303 (See Other)
  • 305 (Use Proxy)
  • 307 (Temporary Redirect)
Note: Status code 304 is not considered a redirect HTTP response status code. Status code 306 is unused.

In the following example, the rewrite action replaces http in the Location header of an HTTP response with https if the response is associated with an HTTP redirect.

add rewrite action redloc replace 'http.res.header("Location").before_regex(re#://#)' '"https"'

add rewrite policy pol1 HTTP.RES.IS_REDIRECT red_location

bind rewrite global pol1 100