Forum Discussion
fzaborowski_311
Nimbostratus
Apr 05, 2010iRule Javascript call?
Hi,
Quick question (I haven't seen this done/documented here):
I wish to call a .js file for users accessing certain pages. The script simply tags their page for us to monitor their performance. Is this possible from within an iRule?
Something like:
when HTTP_REQUEST {
if { [HTTP::uri] contains "/FooPage/" } {
CALL JS SCRIPT FROM WEB SERVER FIRST (prebody), AND ALLOW SESSION TO CONTINUE.
}
}
Thanks for any suggestions or examples you may be aware of.
- hoolio
Cirrostratus
Hi, - fzaborowski_311
Nimbostratus
Hi Aaron, - hoolio
Cirrostratus
The URI isn't saved for response events. So you could check the URI in HTTP_REQUEST and then set a variable to 1 to track whether to inject the javascript in the response:when HTTP_REQUEST { Check if some URI property is true if {[string tolower [HTTP::path]] contains "/foopage/"}{ Track that we'll inject the js in the response set inject_js 1 } else { Track that we won't inject the js in the response set inject_js 0 } } when HTTP_RESPONSE { Check whether we're injecting the js in the response payload if {$inject_js==1}{ Do it... } }
- fzaborowski_311
Nimbostratus
Thanks again Aaron-for taking the time to respond. It is very much appreciated.
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