search cancel

Browser agent problem downloading PDF

book

Article ID: 214445

calendar_today

Updated On:

Products

CA Application Performance Management (APM / Wily / Introscope)

Issue/Introduction

 

Problem in an application due to the Browser Agent.

The problem in particular is with a part of the application where a PDF is downloaded, a file that is saved from a block of the database; that is, the only thing is that the page connects to the database and save that file in a temporary directory. And the problem that later the PDF cannot be opened because it seems to be corrupt.

Accessing the same file directly from the same application without the Browser Agent, there is no problem.

The application does the process in 2 steps; that is, first a request via AJAX that extracts the document from the database and saves it in the user's temporary folder, and a second normal request (location.href ...) that only downloads the file from the temporary to the browser, which is where the error happens.

This only fails in Internet Explorer

 

Cause

 

Comparing the PDFs,  the difference is the header of the browser agent:

For example the header of which works fine:

<?xml version = "1.0" encoding = "UTF-8" ?><HeaderFooterSettings version = "8.0"><Font type="TrueType" size="8.0" name="Arial"/><Color r="0.0" b="0.0" g="0.0"/><Margin right="72.0002" left="72.0002" bottom="36.0001" top="36.0001"/><Appearance fixedprint="0" shrink="0"/><PageRange odd="1" even="1" end="-1" start="-1"/><Page offset = "0"><PageIndex format="1"/></Page><Date><Month format="1"/>/<Day format="1"/><Year format="0"/></Date><Header><Left></Left><Center>tect
</Center><Right></Right></Header><Footer><Left></Left><Center></Center><Right><Page offset = "0"><PageIndex format="1"/></Page></Right></Footer></HeaderFooterSettings>

This is the header in the file with the problem (where you can see the BA lines):

<?xml version = "1.0" encoding = "UTF-8" ?><HeaderFooterSettings version = "8.0"><script x-apm-ba-response-bt="apmAgentHost%3D%2FH8lp8RVqMDe56215dtxUg%3D%3D%2CapmServletName%3D8ixYSliI94d2%2FV72zpwIGA%3D%3D%2CapmAgentProcess%3D%2B8Tl8eU%2Bdo3KMaqp0a9VgQ%3D%3D%2CapmAgentName%3DILGhus6GpoLSSdZhhyx200goJoWQFkWsCv5fnlF3Hfczo%2B5nVAZKQ4QSyXVj06T0%2CapmWebAppName%3D1VJFYg%2F2xYAlni2xQjURpA%3D%3D"  type="text/javascript" id="ca_eum_ba" src="http://172.27.0.76:8080/api/1/urn:ca:tenantId:default-tenant/urn:ca:appId:default-app/bajs?agent=browser" data-profileUrl="http://172.27.0.76:8080/api/1/urn:ca:tenantId:default-tenant/urn:ca:appId:default-app/profile?agent=browser" data-tenantID="default-tenant" data-appID="default-app" data-appKey="b0361800-4736-11e6-b8e5-bddc75280658"></script><Font type="TrueType" size="8.0" name="Arial"/><Color r="0.0" b="0.0" g="0.0"/><Margin right="72.0002" left="72.0002" bottom="36.0001" top="36.0001"/><Appearance fixedprint="0" shrink="0"/><PageRange odd="1" even="1" end="-1" start="-1"/><Page offset = "0"><PageIndex format="1"/></Page><Date><Month format="1"/>/<Day format="1"/><Year format="0"/></Date><Header><Left></Left><Center>tect
</Center><Right></Right></Header><Footer><Left></Left><Center></Center><Right><Page offset = "0"><PageIndex format="1"/></Page></Right></Footer></HeaderFooterSettings>

 

The way the data was being processed was a servlet call.

Due to browser agent response decoration, which is used to match browser agent data to Java agent data, this is added into the response and was being added into the PDF file

Environment

Release : 10.7.0

Component : APM Agents

Resolution

 
 

The URL used to generate the document was excluded from monitoring.

The list of URLs only has an include option so a negative lookahead regex had to be used.

Taking an example URL context of DocumentAction, this configuration excluded the URL from monitoring

introscope.agent.browseragent.autoInjection.default.includeURLsRegex=^(?:(?!DocumentAction).)*$