URI Interrogation
Problem this snippet solves:
This iRule will interrogate and log all components of the URI. It is meant to illustrate how to use the various URI methods to extract the relevant components of the current HTTP::uri.
Code :
when HTTP_REQUEST { log local0. "----------------------" log local0. "URI Information" log local0. "----------------------" log local0. "HTTP: log local0. "----------------------" log local0. "Path Information" log local0. "----------------------" log local0. "HTTP: set depth [URI::path [HTTP::uri] depth] for {set i 1} {$i <= $depth} {incr i} { set dir [URI::path [HTTP::uri] $i $i] log local0. "dir\[$i\]: $dir" } log local0. "Basename: [URI::basename [HTTP::uri]]" log local0. "----------------------" log local0. "Query Information" log local0. "----------------------" log local0. "HTTP: set namevals [split [HTTP::query] "&"] for {set i 0} {$i < [llength $namevals]} {incr i} { set params [split [lindex $namevals $i] "="] set pnum [expr $i+1] log local0. "Param\[$pnum\]: [lindex $params 0]" log local0. "Value\[$pnum\]: [URI::query [HTTP::uri] [lindex $params 0]]" } }
Published Mar 18, 2015
Version 1.0CodeCentral_194
Cirrus
Joined May 05, 2019
CodeCentral_194
Cirrus
Joined May 05, 2019
No CommentsBe the first to comment