URI::encode

Description

Returns the encoded version of the given URI. For details on URI (or percent encoding), see this Wikipedia page: Percent encoding
This command is equivalent to the BIG-IP 4.X variable encode_uri.

Syntax

URI::encode <uri>

URI::encode <uri>

  • Returns the encoded value of the given uri.

Examples

when HTTP_REQUEST {
  set my_parameter_value "my URL encoded parameter value with metacharacters (&*@#[])"
  log local0. "The encoded version of \"$my_parameter_value\" is \"[URI::encode $my_parameter_value]\""
  HTTP::redirect "/path?parameter=[URI::encode $my_parameter_value]"
}

Log output:
The encoded version of "my URL encoded parameter value with metacharacters (&*@#[])" is "my%20URL%20encoded%20parameter%20value%20with%20metacharacters%20(%26*%40%23%5b%5d)"