Skip to main content

Obtaining Server-Timing Content

Agent Configuration​

The agent can successfully obtain the Server-Timing response header if the following conditions are met:

  • x_server_switch is enabled (true: enabled, false: disabled).
  • server_timing is enabled (true: enabled, false: disabled).
  • Same origin. If cross-origin, you need to configure the Ajax request domain in cors_domains.
  • The Server-Timing response header value is not empty.

Example:

window.TINGYUN && window.TINGYUN.init && window.TINGYUN.init(function(ty_rum){ty_rum.server={
...
"x_server_switch":true,"server_timing":true,"cors_domains":["mall.tingyun.com","127.0.0.1:8089"]
...
}});

Enabling Required Server-Side Configuration for Server-Timing​

To prevent errors caused by the agent reading cross-origin response headers, if the Server-Timing switch is enabled, the server must add configuration to allow the browser to let the JavaScript agent access the response header.

When enabling server_timing and x_server_switch, the following response headers are required for cross-origin requests:

# Fill in origin according to actual situation
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Tingyun
Access-Control-Expose-Headers: Server-Timing