Instrumenting an Oracle HTTP Server Using Container-based Injection

If you are using the Oracle HTTP Server 11G, you can use the container substitution pattern to automatically inject the eG Real User Monitoring JavaScript agent into your web pages. This allows you to enable the RUM functionality for your web pages without needing to make any code changes. This mechanism intercepts the response object as it is being returned and makes a string substitution containing the required JavaScript tag at the appropriate place in the HTML.

Note:

The container-based injection method (detailed in this topic) can be used to RUM-enable an Oracle HTTP server v11 (or above) only. For lower versions of the Oracle HTTP server (eg., 10G), you have to use any of the alternate instrumentation mechanisms depicted by Figure 1

The instrumentation steps are as follows:

  1. Open the global httpd.conf file and search for the following commands:

    LoadModule substitute_module modules/mod_substitute.so

    LoadModule filter_module modules/mod_filter.so

  2. Once you find the commands, uncomment them.
  3. Create a directory called egrum on the system hosting the Apache server.
  4. Create a file named egrum.conf in that directory. The contents of the file should be similar to the snippet below:

    <Location />

    AddOutputFilterByType SUBSTITUTE text/html

    substitute "s|</head></head>|<script charset='UTF-8' type='text/javascript'>

    window['egrum-start_time'] = new Date().getTime();

    window['Site_Name'] = '57bf9bbe-5712-40e9-929b-f75c5ab300e9-1606389009637';

    window['beacon-url'] = 'http://RUM_COLLECTOR_DOMAIN_NAME:PORT';

    if(!window['egrum-config']) window['egrum-config'] = {}; (function (config) {config.capture = { jsError:true, resourceDetails:true, ajax:true, ajaxCorrelation:false, overwriteBtmUName:false, excludeURLPattern:'none', ajaxExcludeURLPattern:'none', includeURLPattern:'*'};})(window['egrum-config']);

    </script>

    <script src='http://RUM_COLLECTOR_DOMAIN_NAME:PORT/rumcollector/egrum.js' async></script>

    </head>|inq"

    </Location>

    In the sample contents above, the </head>tag highlighted in Red indicates that this code snippet looks for an exact </head> tag match. Alternatively, you can alter the code snippet to look for a <body> tag match, if required.

    Also, when inserting the code snippet, take care to replace the area highlighted in Green with the exact domain name and port number of the RUM collector.

  1. Next, add the location of the egrum.conf file to httpd.conf, as indicated below:

    Include [absolutePathTo]/egrum.conf

    For instance, if the egrum.conf file resides in the C:\egrum folder, then the above specification will be:

    Include C:\egrum\egrum.conf

  1. Finally, save the file and restart the Oracle HTTP server.

    Note:

    If the Oracle HTTP server is configured as a reverse proxy, you must use the Location directive based method , with the ProxyPass and ProxyPassReverse directives as indicated by the code block below:

    <Location />

    ProxyPass http://mywebsite.index.net/

    ProxyPassReverse http://mywebsite.index.net/

    AddOutputFilterByType SUBSTITUTE text/html

    substitute "s|</head>|</head>|<script charset='UTF-8' type='text/javascript'>

    window['egrum-start_time'] = new Date().getTime();

    window['Site_Name'] = '57bf9bbe-5712-40e9-929b-f75c5ab300e9-1606389009637';

    window['beacon-url'] = 'http://RUM_COLLECTOR_DOMAIN_NAME:PORT';

    if(!window['egrum-config']) window['egrum-config'] = {}; (function (config) {config.capture = { jsError:true, resourceDetails:true, ajax:true, ajaxCorrelation:false, overwriteBtmUName:false, excludeURLPattern:'none', ajaxExcludeURLPattern:'none', includeURLPattern:'*'};})(window['egrum-config']);

    </script>

    <script src='http://RUM_COLLECTOR_DOMAIN_NAME:PORT/rumcollector/egrum.js' async></script>

    </head>|inq"

    </Location>