Server-Timing Content Retrieval
SDK Configurationβ
For the probe to successfully obtain the Server-Timing response header, the following conditions must be met:
- The
requestTracing.enabled
switch is in the on state (true
: on,false
: off). - The
requestTracing.serverTimingEnabled
switch is in the on state (true
: on,false
: off). - Same-origin. If it's a cross-origin situation, the domain name of the Ajax request needs to be configured in
requestTracing.corsDomains
. - The value of the Server-Timing response header is not empty.
Example:
window.TingyunWeb("init", {
...
requestTracing: {
enabled: true,
serverTimingEnabled: true,
corsDomains: ["mall.tingyun.com", "127.0.0.1:8089"],
}
...
})
Server-Side Configuration Required to Enable the Server-Timing Switchβ
To prevent the probe from reporting an error when reading the cross-origin response header, if the Server-Timing switch is turned on, the server response header needs to be configured to allow the JS probe to access the response header.
When enabling requestTracing.serverTimingEnabled
and requestTracing.enabled
, the following response headers are required for cross-origin requests:
# Fill in the origin according to the actual situation
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Tingyun
Access-Control-Expose-Headers: Server-Timing