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 which it is connected.
I read a lot on the forum but I need a concrete example based on my Irule below. Thank you
Can you help me ?
=================================================
when HTTP_REQUEST timing on {
set electedpool [HTTP::cookie "persist"]
if {"" ne $electedpool} {
if { [active_members HOM_JBOSS_VIP1_POOL_$electedpool] >= 1 } {
pool HOM_JBOSS_VIP1_POOL_$electedpool
} else {
set P [expr ($electedpool+1) %2]
set electedpool ""
pool HOM_JBOSS_VIP1_POOL_$P
}
} else {
set P [expr (int(rand()*1000000))%2]
if { [active_members HOM_JBOSS_VIP1_POOL_$P] >= 1 } {
pool HOM_JBOSS_VIP1_POOL_$P
} else {
set P [expr ($P+1) %2]
pool HOM_JBOSS_VIP1_POOL_$P
}
}
}
when HTTP_RESPONSE timing on {
if {"" eq $electedpool} {
HTTP::cookie remove persist
HTTP::cookie insert name persist value "$P" path /
}
}
22 Replies
- James_Quinby_46Historic F5 AccountInteresting - I don't see any errors. All I get are the following lines:
Dec 16 10:25:57 bigip tmm tmm[PID]: Rule temp : CONTENT_LENGTH: 4624 Dec 16 10:25:57 bigip tmm tmm[PID]: Rule temp : NEWDATA: (then a whole lot of stuff follows)
What version of code are you running on your LTM? - hoolio
Cirrostratus
If you want to insert text in the response content, you could use a stream profile and iRule to configure it. You can use this rule by adding a blank stream profile to the VIP and a custom HTTP profile with Response Chunking set to Rechunk.when HTTP_RESPONSE { Check if response type is text if {[HTTP::header value Content-Type] contains "text"}{ Replace with 1.1.1.1 where 1.1.1.1 is the server IP adddress STREAM::expression "@<\[Tt\]\[Ii\]\[Tt\]\[Ll\]\[Ee\]>@[IP::server_addr] - @" Enable the stream filter for this response only STREAM::enable } else { Response wasn't text, so disable the stream filter STREAM::disable } } when STREAM_MATCHED { This event can is for debug only and can be removed once testing is complete log local0. "Matched: [STREAM::match]" }
I'd guess the TCL error with the payload replace is occurring when the response size is over 1Mib and the collection is being limited to just a portion of the response payload.
Aaron - James_Quinby_46Historic F5 AccountThe stream profile approach is much better. That's where I went first, but somehow couldn't get IP::server_addr evaluated rather than simply displayed as a string.
- James_Quinby_46Historic F5 Account...also, you might consider substituting LB::server for IP::server_addr. This would display the pool name, IP and port of the server, and might be useful if you have more than one jboss instance running on each node.
- BMARTIN_12200
Nimbostratus
Thank you very much for your help hoolio and jquinby , the solution stream profile suits me. I have just one last question:
Are there any disadvantages to validate the stream profile in the virtual server configuration. - hoolio
Cirrostratus
jquinby, if you wrap the stream expression in curly braces, the commands inside are interpreted literally and aren't executed. Using double quotes allows for execution, but then you have to escape the square braces in the regex components to prevent them from being executed.
Bruno, are you asking if there is any downside to using a stream profile (without an iRule)? The reason you'd want to use an iRule to configure the stream filter is that you can explicitly enable it only for responses and only for text content. If that's not what you're asking, can you explain again?
Thanks,
Aaron - BMARTIN_12200
Nimbostratus
I'm sorry but I encounter a problem with the establishment of the "stream filter".
The display of my page worked well but now the images are not displayed and all is white.
When I withdraw the rule and I repositions the stream profile to none everything works??
Below this error
Dec 17 15:37:22 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_EGRESS_DATA during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:22 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_EGRESS_DATA during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:22 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_EGRESS_DATA during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:22 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_EGRESS_DATA during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:22 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_EGRESS_DATA during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:23 tmm tmm[1537]: 011f0007: repeated 25 times
Dec 17 15:37:40 tmm tmm[1537]: Rule irule_REC_JBOSS_VIP4_SET_TITLE_BROWSER : Matched:
Dec 17 15:37:41 tmm tmm[1537]: Rule irule_REC_JBOSS_VIP4_SET_TITLE_BROWSER : Matched:
Dec 17 15:37:41 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_EGRESS_DATA during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:41 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_EGRESS_DATA during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:42 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_EGRESS_DATA during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:42 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_EGRESS_DATA during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:42 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_EGRESS_DATA during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:42 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_EGRESS_DATA during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:44 tmm tmm[1537]: 011f0007: repeated 55 times
Dec 17 15:37:44 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_BODY_COMPLETE during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:44 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_BODY_COMPLETE during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:44 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_EGRESS_DATA during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:44 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_EGRESS_DATA during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:44 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_EGRESS_DATA during ST_HTTP_PREPEND_HEADERS
Dec 17 15:37:47 tmm tmm[1537]: 011f0007: repeated 9 times - hoolio
Cirrostratus
Which LTM version are you running? You might consider opening a case with F5 Support as there doesn't seem to be a simple explanation for this error when using a stream profile.
Aaron - BMARTIN_12200
Nimbostratus
I set a record after
STREAM:: expression "@ <\[Tt\]\[Ii \]\[Tt\]\[Ll\]\[Ee\]>@ [IP: server_addr] - @"
local0 log. "@ <\[Tt\]\[Ii\]\[Tt\]\[Ll\]\[Ee\]>@ [IP: server_addr] - @"
and I see that I began two lines with two members of my pool
Dec 17 16:40:46 tmm tmm[1537]: Rule irule_SET_NVIP_BROWSER : @<[Tt][Ii][Tt][Ll][Ee]>@10.242.81.157 - @
Dec 17 16:40:46 tmm tmm[1537]: Rule irule_SET_NVIP_BROWSER : @<[Tt][Ii][Tt][Ll][Ee]>@10.242.81.156 - @
Dec 17 16:40:46 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_BODY_COMPLETE during ST_HTTP_PREPEND_HEADERS
Dec 17 16:40:46 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_BODY_COMPLETE during ST_HTTP_PREPEND_HEADERS
Dec 17 16:40:46 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_BODY_COMPLETE during ST_HTTP_PREPEND_HEADERS
Dec 17 16:40:46 tmm tmm[1537]: 011f0007:3: http_process_state_prepend - Invalid action EV_BODY_COMPLETE during ST_HTTP_PREPEND_HEADERS
Dec 17 16:40:47 tmm tmm[1537]: 011f0007: repeated 26 times - BMARTIN_12200
Nimbostratus
My version is BIG-IP 9.4.0 Build 529.7
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
