Forum Discussion

Viv_Richards's avatar
Viv_Richards
Icon for Cirrostratus rankCirrostratus
Jun 15, 2022

AppDynamics Javascript Injection iRule for monitoring

Herewith iRule for AppDynamics Javascript Injection iRule

In this iRule /title has been replaced and javascript has been injected

======================================== 

when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/"}{
set enableEum 1
HTTP::header remove "Accept-Encoding"
}
# Disable the stream filter for client requests as we are only interested in the server response
STREAM::disable
}
when HTTP_RESPONSE {
STREAM::disable
if {($enableEum == 1) && ([HTTP::header "Content-Type"] starts_with "text/html")}{
STREAM::expression "@</title>@</title><script>window\[\'adrum-start-time\'\] = new Date().getTime();(function(config)\{config.appKey = \'EEE-EEE-EEE\';config.adrumExtUrlHttp = \'http://cdn.appdynamics.com\';config.adrumExtUrlHttps = \'https://cdn.appdynamics.com\';config.beaconUrlHttp = \'http://col-eum-abcd.com\';config.beaconUrlHttps = \'https://col-eum-abcd.com\';config.xd = \{enable : false\};\})(window\[\'adrum-config\'\] || (window\[\'adrum-config\'\] = \{\}));</script><script type=\'text/javascript\' src=\'//cdn.appdynamics.com/adrum/adrum-latest.js\'></script>@"
STREAM::enable
}
}

============================ 

Stream profile also required for this. 

This iRule has been tested and working successfully 

Regards