Server-Timing header
The Server-Timing response header: cache status, the cache layer that answered, and origin connect and first-byte times, visible in browser developer tools.
What it does
When enabled, the node appends a Server-Timing header to responses. It states the cache status of the request, which cache layer answered, and how many milliseconds the node spent connecting to the upstream and waiting for its first response bytes. Server-Timing entries returned by your origin are kept; the node only appends.
When to use it
- A page is slow and you want to know whether the cache missed or the origin itself is slow.
- You want to confirm whether a request was answered by the edge cache or by the L2 cache.
- You want to compare origin connect and first-byte times across hours or resources.
Where to configure it
In the console: Sites, pick the site, open Edit, then "Advanced settings". The "Server-Timing header" switch is in the "Other" card. It is saved on its own and takes effect on the next publication.
Settings
| Setting | Default | Description |
|---|---|---|
| Server-Timing header | Off | Site-level switch |
Header contents
| Entry | Appears when | Content |
|---|---|---|
cdn-cache | The site has caching on | desc is the node's cache status, the same value as X-CDN-Cache |
cdn-hit-layer | A cache layer answered | desc=edge: this node hit; desc=l2: this node missed and the L2 hit |
cdn-connect | The request opened an upstream connection | dur is the milliseconds the node took to connect to the upstream |
cdn-ttfb | The request got an upstream response | dur is the milliseconds from sending the request to receiving the upstream response headers |
An entry that does not apply is left out; if none apply, the header is not added. Example:
Server-Timing: cdn-cache;desc=MISS, cdn-hit-layer;desc=l2, cdn-connect;dur=3, cdn-ttfb;dur=41The header contains only status words and whole milliseconds. It carries no node name, node address, origin address or tenant identifier.
FAQ
Where do I see the header
In the Network panel of your browser's developer tools, select the request and read the response headers. Some browsers also list the entries under the Timing tab.
A cross-origin script cannot read it
Same-origin pages and developer tools see it directly. To let scripts from other origins read it, add Timing-Allow-Origin yourself in the site's HTTP policy response headers.
The switch is on but the header is missing
Check in order: the setting has been published after saving; the target nodes run a version that supports it (the publish page lists nodes that need an upgrade); and the site is not at attack escalation level B or above, where the header is withheld just like the cache status header.
Why is there no cdn-connect on a cache hit
A hit does not go to the upstream, so there is no connection and no upstream first byte; those two entries do not appear.