Forum Discussion
BMARTIN_12200
Nimbostratus
Dec 15, 2008Add Ip member pool in my header browser
Hello, my application is spread over 24 servers JBOSS cluster of 6 pools of 4 members. To facilitate maintenance I would like to appear in the title of the browser the IP address of the member on whic...
James_Quinby_46
Dec 15, 2008Historic F5 Account
There are, in all likelihood, more elegant ways of doing this, but this works on my lab unit:
when HTTP_REQUEST {
Don't allow data to be chunked - override whatever the
browser has told us.
if { [HTTP::version] eq "1.1" } {
if { [HTTP::header is_keepalive] } {
HTTP::header replace "Connection" "Keep-Alive"
}
HTTP::version "1.0"
}
}
when HTTP_RESPONSE {
if we know how much we're getting back, grab it all. If
we don't know how much we're getting back, grab an arbitrarily
long chunk of data that ought to get it all.
if { [HTTP::header Content-Type] starts_with "text/html" } {
if { [HTTP::header exists "Content-Length"] } {
set content_length [HTTP::header "Content-Length"]
} else {
set content_length 1000000000
}
if { $content_length > 0 } {
HTTP::collect lets us manipulate the data via the next stanza
below.
HTTP::collect $content_length
}
}
}
when HTTP_RESPONSE_DATA {
and now the payoff - a regex substitution of the opening title tag
with the tag + the value contained in IP::server_addr. Additional text
could be added as well.
regsub -all "" [HTTP::payload] " [IP::server_addr]" newdata
HTTP::payload replace 0 $content_length $newdata
HTTP::release
}
Another method would simply be to pass the server IP in a special HTTP header. This would be much lighter weight, but obviously not as easy to look at.
(updated with some cleanup and comments)
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