Not a customer? Click the 'Start a free trial' link to begin a 30-day SaaS trial of our product and to join our community.
Existing Cisco AppDynamics customers should click the 'Sign In' button to authenticate to access the community
10-31-2018 04:48 PM - edited 04-03-2019 02:46 PM
A load balancer is a device that distributes network or application traffic across a number of servers. Load balancers are used to increase the capacity and reliability of applications.
When properly configured, F5 iRules utilize a scripting syntax that allows the load balancer to intercept, inspect, transform, and direct inbound or outbound application traffic.
In the event that the application's source is unable to be modified and all other forms of injection have failed or are not applicable (e.g., assisted injection through Java rules for a PHP-based application), clients with a F5 load balancer can request their network security team configure an iRule to intercept an application's response and inject HTML into the page source necessary for enabling EUM. This is similar to the format that manual injection uses, but HTML is inserted into the webserver's response rather than into the original source code.
For instructions on how to build, deploy, and test an iRule, we recommend consulting your F5 support team and network security team since they are most knowledgeable and equipped to handle such a request. From an AppDynanics perspective, you must be properly licensed for EUM and have End User Monitoring (EUM) enabled for an application in your AppDynamics Controller UI. Clients who have the limited option of injection via F5 iRules have seen success using a template similar to the iRule listed below.
Note: If you are using the 4.3.x EUM JavaScript Agent, click here for instructions.
when HTTP_REQUEST {
if { [HTTP::uri] contains "segments/in/uri" } {
set enableEum 1
HTTP::header remove "Accept-Encoding"
}
STREAM::disable
}
when HTTP_RESPONSE {
STREAM::disable
if { ( $enableEum == 1 ) && ( [HTTP::header "Content-Type"] starts_with "text/html" ) } {
set search "</title>"
set replace "</title>\
<script type='text/javascript' charset='UTF-8' src='//application.domain.com/adrum/adrum-config.js'></script>"
STREAM::expression {@${search}@${replace}@}
STREAM::enable
}
unset enableEum
unset search
unset replace
}
1) Matching Condition - The matching condition in your first "if statement."
Change the condition in the above template to match inbound traffic to your application. In the template, we match against segments in the application's URI. However, there are other properties that can be used (e.g., [HTTP::path], [HTTP::host], etc.).
[HTTP::uri] contains "segment/in/uri"
2) Compression - Does your application use compression?
If you are unsure if compression is being used, there is a simple Curl test to find out. The results will return one of three responses:
If the first or second response comes back, that means the site is using compression. An empty response means that compression is not being used.
curl -sILH 'Accept-Encoding: gzip,deflate' <<URL>> | grep -i 'content-encoding'
Example:
curl -sILH 'Accept-Encoding: gzip,deflate' www.appdynamics.com | grep -i 'content-encoding'
Response:
content-encoding: gzip
If compression is being used, uncomment the following line from the template.
HTTP::header remove "Accept-Encoding"
If there isn't any compression, then keep the line commented out or remove it from the rule completely.
# HTTP::header remove "Accept-Encoding"
3) JavaScript Agent Config (adrum-config.js) - What is the JavaScript agent config file and where does it get hosted?
An agent config file (adrum-config.js
) is injected directly into the page source. It is a small JavaScript file that contains the JavaScript Agent configuration options, such as the location of the adrum.js
file, EUM application key, etc. The agent-config.js
file is a self-hosted file.
<script type='text/javascript' charset='UTF-8' src='//application.domain.com/adrum/adrum-config.js'></script>
Before using the adrum-config.js
file to initialize your JavaScript Agent configuration, you will need to update the file to match your EUM Application Key, hosted location of the JavaScript Agent files (adrum.js
or adrum-latest.js
), and the URL for the EUM Server (SaaS or On-Prem).
The adrum-config.js
example below assumes you are using our EUM cloud to process the JavaScript Agent beacon data, as well as the latest JavaScript Agent hosted in our CDN. You will need to create a file similar to this and host it yourself. A customized version of this file can be downloaded from within your EUM Application's configuration as documented here.
window['adrum-start-time'] = new Date().getTime();
(function(config) {
config.appKey = 'EUM-APP-KEY';
config.adrumExtUrlHttp = 'http://cdn.appdynamics.com';
config.adrumExtUrlHttps = 'https://cdn.appdynamics.com';
config.beaconUrlHttp = 'http://col.eum-appdynamics.com';
config.beaconUrlHttps = 'https://col.eum-appdynamics.com';
config.xd = { enable: false };
config.spa = { "spa2": false };
}
)(window['adrum-config'] || (window['adrum-config'] = {}));
document.write(unescape('%3Cscript')
+ " src='//cdn.appdynamics.com/adrum/adrum-latest.js' "
+ " type='text/javascript' charset='UTF-8' "
+ unescape('%3E%3C/script%3E'));
4) JavaScript Agent Config Options – What is your application-specific configuration?
config.appKey = 'EUM-APP-KEY';
document.write(unescape('%3Cscript')
+ " src='//cdn.appdynamics.com/adrum/adrum-latest.js' "
+ " type='text/javascript' charset='UTF-8' "
+ unescape('%3E%3C/script%3E'));
config.beaconUrlHttp
and config.beaconUrlHttps
above. For more information on how to find this URL, please refer to our documentation on manual injection found here.config.beaconUrlHttp = 'http://col.eum-appdynamics.com'; config.beaconUrlHttps = 'https://col.eum-appdynamics.com';
JavaScript Agent Extension Location - Where should the agent download the adrum-ext.js file?
If you are hosting the JavaScript Agent extension file yourself, you will want to update the config.adrumExtUrlHttp
and config.adrumExtUrlHttps
above. For more information on how to find this URL, please refer to our documentation on manual injection found here.
config.adrumExtUrlHttp = 'http://cdn.appdynamics.com';
config.adrumExtUrlHttps = 'https://cdn.appdynamics.com';
config.xd
in the template above.config.xd = { enable: true };
config.spa
in the template above.config.spa = { "spa2": true };
5) Other Points To Consider
If properly configured, the iRule matches a condition for your application-specific traffic, the load balancer will inject the EUM-specific source via the adrum-config.js
file into the response received by the browser. This will allow the Javascript Agent and the associated configurations to load in the browser, capture EUM data, and send the associated beacons back to the EUM Server.
<script type='text/javascript' charset='UTF-8' src='//application.domain.com/adrum/adrum-config.js'></script>
Sample Files (see attachments):
Another mechanism to leverage F5 to perform injection, instead of using iRules - https://www.slideshare.net/appdynamics/appsphere-16-improving-the-user-experience-with-appdynamics-e...
Thank you! Your submission has been received!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form