Forum Discussion
Fiko_29923
Nimbostratus
Jun 17, 2011insert javascript to html pages using irules
Hi, I want to ask is it possible to insert javascript to existing web pages?
e.g. I have web pages which already running and use it as pool member for load balancing. Using iRules, I want to chec...
hoolio
Cirrostratus
Jun 17, 2011Hi Fiko,
Here's an untested example to start with. It requires a blank stream profile and a custom HTTP profile with response chunking set to rechunk be added to the virtual server.
when HTTP_REQUEST {
Disable stream filter by default
STREAM::disable
Don't allow response data to be chunked
if { [HTTP::version] eq "1.1" } {
Force downgrade to HTTP 1.0, but still allow keep-alive connections.
Since HTTP 1.1 is keep-alive by default, and 1.0 isn't,
we need make sure the headers reflect the keep-alive status.
if { [HTTP::header is_keepalive] } {
HTTP::header replace "Connection" "Keep-Alive"
}
}
}
when HTTP_RESPONSE {
if {[HTTP::header Content-Type] starts_with "text/"} {
Remove the spaces before and after head in < head >
STREAM::expression {@< head >@@}
STREAM::enable
}
}
when STREAM_MATCHED {
Once we've hit one match, disable the stream filter for the rest of the response
STREAM::disable
}
Aaron
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