AWS Cloudfront Server-Timing

RUMvision can collect Amazon CloudFront timing data when your website exposes it through the Server-Timing response header.

This helps you understand whether slow server response times are caused by CloudFront cache behavior, CloudFront routing, or the origin server.

If your site is not exposing these headers yet, you can enable them in CloudFront with a Response Headers Policy.

Add Server-Timing via Amazon CloudFront

Available fields

Below are Server-Timing fields that are exposed by Amazon Cloudfront. A few of them are being tracked by default if Amazon CloudFront is selected as the CDN in your tech stack settings. When you enabled the Amazon CloudFront tracking dimensions checkbox, we will automatically collect them.

ValueCollected/typeMeaning
cdn-upstream-fblMetricFirst byte latency from the origin after CloudFront completed the origin request.
cdn-downstream-fblMetricTime between CloudFront receiving the viewer request and sending the first byte of the response to the viewer.
cdn-upstream-connectMetricTime spent establishing the TCP connection and TLS session with the origin.
cdn-popFilter
transformed
The CloudFront point of presence that handled the request.
cdn-cache-hitFilter
transformed
CloudFront served the response from cache without contacting the origin.
cdn-cache-missFilter
transformed
CloudFront did not serve the response from cache and requested the object from the origin.
cdn-cache-refreshFilter
transformed
CloudFront served the response from cache after validating it with the origin.
cdn-hit-layerFilter
transformed
Shows which CloudFront cache layer served the response, such as EDGE, REC, or Origin Shield.
cdn-upstream-layerFilter
transformed
Shows which CloudFront layer contacted the origin, such as EDGE, REC, or Origin Shield.
cdn-upstream-dnsNot collected
no, reach out
Time spent resolving the origin DNS record.

Where to implement

In AWS, go to:

CloudFront → Policies → Response headers → Create response headers policy

Then enable the Server-Timing header setting and attach the response headers policy to the cache behavior used by your HTML document requests.

Rule to implement

Create or update a Response Headers Policy and enable Server-Timing.

SettingValue
Server-Timing headerEnabled
Sampling rate100
Apply toThe cache behavior used for HTML document requests

Using a sampling rate of 100 means CloudFront adds the Server-Timing header to every matching response.

Testing the outcome

Next step is testing the outcome. You could either wait for data to arrive in your RUMvision dashboard, or proactively test the outcome using the DevTools of your preferred browser.

Expected outcome

After enabling Server-Timing, a cache miss may return a header similar to this:

Server-Timing: cdn-upstream-layer;desc="EDGE",cdn-upstream-dns;dur=0,cdn-upstream-connect;dur=114,cdn-upstream-fbl;dur=177,cdn-cache-miss,cdn-pop;desc="PHX50-C2",cdn-downstream-fbl;dur=436

For a cached response, the header may look like this:

Server-Timing: cdn-cache-hit,cdn-pop;desc="SEA19-C1",cdn-hit-layer;desc="REC",cdn-downstream-fbl;dur=137

Check the response headers

To verify the setup:

  1. Open your website in Chrome or Edge.
  2. Open DevTools.
  3. Go to the Network tab.
  4. Reload the page.
  5. Click the main HTML document request.
  6. Check the Response Headers section.
  7. Look for server-timing.

Test in DevTools Console

As the browser exposes Server-Timing values through the PerformanceServerTiming interface, you can also test it in the browser console by running the following JavaScript:

const navEntries = window.performance.getEntriesByType('navigation'); console.table( navEntries[0].serverTiming );

After running this in your DevTools Console, you should see a table similar to the one below:

Important

In general, be sure to:

  • Always test on staging environment before deploying these steps to a production environment.
  • Avoid exposing sensitive internal details. Server-Timing data is visible in the browser, so only expose metrics that are safe to share with visitors and third-party scripts.

RUMvision auto-transforms

In a few specific cases, the RUMvision tracking script will automatically transform values or collapse keys:

  • Cloudfront uses different keynames per CDN hit/upstream layer, depending on the caching status.
    To be able to see and use that value in a single filter, RUMvision tracking script will collapse them back to a single field.
  • Cloudfront uses different keys per caching status.
    To be able to see and filter caching status as a value, RUMvision tracking script will collapse them back to a single field and stores the last part of the key after capitalizing it (HIT, MISS, REFRESH).
    We do this via entry.name.split('-').pop().toUpperCase()
  • Cloudfront will use values like AMS58-P4 for cdn-pop.
    RUMvision tracking script will slice of the first three characters of the cdn-pop value so that -in this example- only AMS remains.
    We do this via String(entry.description).slice(0, 3)

AWS Cloudfront notes

Make sure the Response Headers Policy is attached to the CloudFront cache behavior that serves your HTML document requests.

If the sampling rate is lower than 100, not every real user page view will expose these metrics. For RUM monitoring, we recommend 100 unless you have a specific reason to sample.

If your origin already sends a Server-Timing header, CloudFront may append its own metrics to the same header. Keep metric names unique to avoid confusion.