Forum Discussion
BMARTIN_12200
Nimbostratus
Feb 17, 2009stream profile - set title browser
Hello, I created a rule to add information to the title field of the browser. His works on the first page of the portal, but when I open another application html from this portal, the title is not changed. Why?
Version:BIG-IP 9.3.1 Build 46.7
when HTTP_RESPONSE {
STREAM::disable
if { [HTTP::header value Content-Type] contains "text" }{
switch [IP::server_addr] {
"x.x.x.nn" { set nvip "thisname_nn" }
"x.x.x.uu" { set nvip "thisname_uu" }
default { set nvip [IP::server_addr] }
}
STREAM::expression "@<\[Tt\]\[Ii\]\[Tt\]\[Ll\]\[Ee\]>@$nvip @"
Active "stream profile"
STREAM::enable
}
}
when STREAM_MATCHED {
log local0. "<\[Tt\]\[Ii\]\[Tt\]\[Ll\]\[Ee\]>: matched: [STREAM::match], replaced with: $nvip "
}
5 Replies
- hoolio
Cirrostratus
Hi Bruno,
Is the STREAM_MATCHED log entry made on any response after the first one? Is it possible that the server is compressing the response data after the first response? If so, you could tell the server to not use compression by removing the Accept-Encoding request header:when HTTP_REQUEST { If we're rewriting the response content, prevent the server from using compression in its response by removing the Accept-Encoding header from the request. LTM does not decompress response content before applying the stream filter. Ideally, we'd only remove it if we're rewriting response content. if { $::rewrite_response_payload } { if { [HTTP::header exists "Accept-Encoding"] } { Remove the Accept-Encoding header from the request HTTP::header remove "Accept-Encoding" } } }
If you don't know in the request that you'll rewrite the response, then you would have to remove the Accept-Encoding header from all requests.
Aaron - BMARTIN_12200
Nimbostratus
Hi Hoolio, I added at the beginning of the rule and have your code the following errorwhen HTTP_REQUEST { if { $::rewrite_response_payload } { if { [HTTP::header exists "Accept-Encoding"] } { Remove the Accept-Encoding header from the request HTTP::header remove "Accept-Encoding" } } } when HTTP_RESPONSE { STREAM::disable if { [HTTP::header value Content-Type] contains "text" }{ switch [IP::server_addr] { "x.x.x.nn" { set nvip "thisname_nn" } "x.x.x.uu" { set nvip "thisname_uu" } default { set nvip [IP::server_addr] } } STREAM::expression "@<\[Tt\]\[Ii\]\[Tt\]\[Ll\]\[Ee\]>@$nvip @" Active "stream profile" STREAM::enable } } when STREAM_MATCHED { log local0. "<\[Tt\]\[Ii\]\[Tt\]\[Ll\]\[Ee\]>: matched: [STREAM::match], replaced with: $nvip " }
ERROR in /var/log/ltm
Feb 18 10:40:36 tmm tmm[1145]: 01220001:3: TCL error: Rule irule_TEST_JBOSS_SET_TITLE_BROWSER - can't read "::rewrite_response_payload": no such variable while executing "if { $::rewrite_response_payload } { if { [HTTP::header exists "Accept-Encoding"] } { Remove the Accept-Encoding header from the r..." - hoolio
Cirrostratus
That global variable was just there as an example of selectively removing the Accept-Encoding header if you knew you were going to rewrite the response. In your case, it doesn't seem like you can determine this from the request. So can you try this example which removes the header from every request?when HTTP_REQUEST { if { [HTTP::header exists "Accept-Encoding"] } { Remove the Accept-Encoding header from the request HTTP::header remove "Accept-Encoding" } } when HTTP_RESPONSE { STREAM::disable if { [HTTP::header value Content-Type] contains "text" }{ switch [IP::server_addr] { "x.x.x.nn" { set nvip "thisname_nn" } "x.x.x.uu" { set nvip "thisname_uu" } default { set nvip [IP::server_addr] } } STREAM::expression "@<\[Tt\]\[Ii\]\[Tt\]\[Ll\]\[Ee\]>@$nvip @" Active "stream profile" STREAM::enable } } when STREAM_MATCHED { log local0. "<\[Tt\]\[Ii\]\[Tt\]\[Ll\]\[Ee\]>: matched: [STREAM::match], replaced with: $nvip " }
Thanks,
Aaron - BMARTIN_12200
Nimbostratus
I changed the rule to remove the header on all requests, but this does not solve my problem - hoolio
Cirrostratus
Hi Bruno,
Can you add logging to the iRule to see if which parts of the code are being run? Does the response Content-Type header in the failing responses start with text?
If you use a browser plugin like Fiddler for IE or HttpFox for FF, do you see any differences in the responses that are correctly rewritten and those that aren't? If not, can you capture a binary formatted tcpdump of a success and failure to compare them? If you need help analysing the tcpdumps you could open a case with F5 Support.
If none of these suggestions help, it would be good to open a case with F5 and get some more in depth help in troubleshooting the issue. If you end up doing this and find the answer, can you reply here to let us know what the issue was?
Thanks,
Aaron
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