Forum Discussion
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 cookies and pool status.
This is useful for ie comparing content on different servers and checking server status. This iRule works perfectly fine on my identical test-vip (in same LB) when I am alone on the vip. But when I add this iRule to the prod. vip with live traffic on, it works ~1 time out of 10 when refreshing the page.
It is this "HTTP::respond 200 content" that's not working correctly when there's traffic. If I rewrite the iRule and only use
HTTP_REQUEST the "HTTP::respond 200 content" works flawlessly but then again I won't get the correct pool member data
since load balancing is not done yet during the request. Would appreciate any advice...
EDIT: Oops format went wrong. Sorry. Uploaded iRule as attachment instead.
- RasmanNimbostratusAh.. 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
* 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