Forum Discussion
Rasman_75397
Feb 10, 2011Nimbostratus
iRule HTTP::respond problem
I'm am stuck with this annoying iRule problem.
I'm writing this iRule so testers can check to which pool member they are connected without the need to look in access logs. Also displays the cook...
Rasman
Feb 10, 2011Nimbostratus
Ah.. now I found the code option. Sorry, new here 🙂
when HTTP_REQUEST {
Check URI and match against allowed IP-addresses
if { [HTTP::uri] contains "check-status" and [matchclass [IP::remote_addr] equals $::private_networks]} {
set ::reqcookiecount [HTTP::cookie count]
set ::refererurl [string map [list "check-status" ""] [HTTP::uri]]
set ::reqcookies ""
set ::printout "yes"
Fetch the cookie names and content
foreach cookie [HTTP::cookie names] {
append ::reqcookies "$cookie = [HTTP::cookie value $cookie]"
}
}
}
when HTTP_RESPONSE {
if { $::printout equals "yes"} {
Get cookie information
set rescookiecount [HTTP::cookie count]
set rescookies ""
foreach cookie [HTTP::cookie names] {
append rescookies "$cookie = [HTTP::cookie value $cookie]"
}
Get time and format it
set curtime [clock seconds]
set formattedtime [clock format $curtime -format {%d %b %Y %T}]
Print web page
log "This is where page is printed out."
HTTP::respond 200 content "
"
set ::printout ""
set ::refererurl ""
}
}
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects