cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to inject JS while page is compressed using gzip?

keane_yu
Dynatrace Participant
Dynatrace Participant

Hi,

There's a Java Web application runing on Resin, end user uses browser to access the applicaiton directly (no any Web Server in between).

I found OneAgent only injected JS to pages without gzip, while most of the pages were gzip compressed.

Any idea on how to use RUM at this situation?

Thanks,

Keane


7 REPLIES 7

ADPaoloni
Mentor

What about manually injecting the tag?


keane_yu
Dynatrace Participant
Dynatrace Participant

Hi Dante, manual injection and browser extension is not acceptable in the environment. We are looking for the possibility of tunning in OneAgent side.


Julius_Loman
DynaMight Guru
DynaMight Guru

Quick solution is to turn off the gzip compression (if this is possible). I don't have any experience with Resin, but I've encountered such situation more than once and it happens when output is gzip compressed too soon in the stack (actually the servlet produces gzip output).

Other methods you can do:

  • modify browser (headers) so they won't accept gzip compression (can be done for Mozilla / Chrome using a browser extension or configuration)
  • place a reverse proxy (nginx work well) between the user and the application and install oneagent on the host (this will inject JS)
  • if there is an application firewall between user and the server, you can modify the request headers not to accept compression (compression will happen between user and application firewall only)
  • use the Dynatrace browser extension
  • inject the JS code directly into the app

TEMPEST a.s., Slovakia, Dynatrace Master Partner

keane_yu
Dynatrace Participant
Dynatrace Participant

Thanks for the suggestion.

I tested Tomcat with gzip, OneAgent can inject js, so I think OneAgent has the capability to inject js before gzip filter run.


AlexanderSommer
Dynatrace Pro
Dynatrace Pro

Hi Keane,

You are right. On Java our OneAgent only injects into non compressed responses. The OneAgent tries to find a possibility to hook into the response processing chain before a compression takes place, which seems not to work for your environment.

These are our 4 main possibilities to overcome this challenge:

  1. Turn on an experimental feature to do a recompression. As this will add some overhead it can only be set by our support engineers.
  2. Try to identify the right place for injection in the response processing chain. We can define a java class name like a specific response filter which is involved before the compression in the chain and then the injection will be done within this class.
  3. Place a web server like Apache or Nginx in front of your Java server
  4. Manual injection - but as you wrote before this is not acceptable for you

Please create a support ticket in order to investigate if 1) or 2) can work. Please keep in mind that this works like we have designed it, as most of our customers are using a web server in front of their Java tier and we want to reduce the overhead on the "application tier" to the minimum.
But we can try to find a workaround.

All the best, Alex


Hi Alex, how to perform method 2? Any detailed steps?

Suport case is 21227


Hello,

We have java i.e tomcat infront of our loadblancer we don't have any apache webserver. Will RUM get injected in this case?

We dont see RUM data on oneagent tenant. Can someone help?

Thanks,

Prathyusha