Forum Discussion
Igor_Morgado_38
Feb 03, 2011Nimbostratus
HTTP response data (html body) rewrite - questions
Helloset as
Im trying to apply a stream profile to change a string in html response from server the source is:
body marginheight="0" marginwidth="0" rightmargin="0" leftmargin="0" topmargin="0" onload="onLoadBody()"
I want to
body marginheight="0" marginwidth="0" rightmargin="0" leftmargin="0" topmargin="0"
Creating a stream profile seems not work, my actual configuration in stream profile is:
Source: onload="onLoadBody()"
Target: (empty) tried put some placeholder and also didnt worked.
My VS has the following configs:
virtual vs_mgp {
snat automap
pool mgp_http_pool
destination 172.27.0.251:http
ip protocol tcp
persist mgp_pr_srcaddr
profiles {
mgp-http-lan-optimized-caching {}
mgp-oneconnect {}
mgp-tcp-lan-optimized {
serverside
}
mgp_remove_onload {}
tcp-wan-optimized {
clientside
}
}
}
ltm profile http mgp-http-lan-optimized-caching {
defaults-from http-lan-optimized-caching
insert-xforwarded-for disabled
ramcache disabled
ramcache-uri-exclude none
ramcache-uri-include none
ramcache-uri-pinned none
response-chunking rechunk
}
ltm profile one-connect mgp-oneconnect {
defaults-from oneconnect
}
ltm profile stream mgp_remove_onload {
defaults-from stream
source "onload=\"onLoadBody()\""
target TAGME
}
6 Replies
Sort By
- Hi Igor,
- Is the server sending compressed response payloads? If so, LTM won't decompress it before applying the stream profile. You could check the responses using a browser plugin like HttpFox for Firefox or Fiddler2. If you want to prevent server response payload compression, you can use a simple iRule:
when HTTP_REQUEST { HTTP:header remove "Accept-Encoding" }
- Right,
when HTTP_REQUEST { Disable the stream filter for all requests STREAM::disable } when HTTP_RESPONSE { Check if response type is text if {[HTTP::header value Content-Type] contains "text"}{ Remove Body onload attribute STREAM::expression "@onload=\"onLoadBody()\"@@" Enable the stream filter for this response only STREAM::enable } }
- That looks good to me. You could avoid the backslash escapes by using curly braces to prevent interpretation:
- Nice. It worked, but I have noticed that my problem was the Accept Encoding.
- If you have compression licensed on LTM, you could enable it in a custom HTTP profile. LTM would apply the stream profile/iRule first and then compress the response content.
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