iRules Live!

Problem this snippet solves:

Sometimes it would be nice to be able to test the output of an iRule command without having to write a whole rule and implement it.

How to use this snippet:

Usage: http://vs_address/request|response/command

Replace spaces in commands with underscore "_"


RESULT AES 128 0430890e8eb3dbbc87584439f5830c87

RESULT /Common/http_pool

RESULT Apache/2.2.22 (Debian)

RESULT Host Connection Upgrade-Insecure-Requests User-Agent Accept Accept-Encoding Accept-Language[HTTP::header_names]_{_append_response_"$name:_[HTTP::header_$name]%5Cn"_}

Date: Thu, 13 Apr 2017 04:23:58 GMT
Server: Apache/2.2.22 (Debian)
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 289
Connection: close
Content-Type: text/html; charset=iso-8859-1

Todo: Come up with simpler ways to encode certain characters.

Code :

  foreach { ignore event command } [ split [HTTP::uri] "/" ] break
  log local0. "COMMAND [string map {_ " "} [URI::decode $command]]"
  set response ""
  if {$event eq "request"} {
    catch [string map {_ " "} [URI::decode $command]] output
    HTTP::respond 200 content "RESULT $output\n$response" Content-Type "text/plain"
  if {$event eq "response"} { 
    catch [string map {_ " "} [URI::decode $command]] output
    HTTP::respond 200 content "RESULT $output\n$response" Content-Type "text/plain"

Tested this on version:


Updated Aug 16, 2022
Version 2.0

Was this article helpful?

No CommentsBe the first to comment