Analyzing CDN Response Headers

In this article, you’ll learn which HTTP headers are set in CDN responses and what they mean.


In this example, we’ll use curl to show which headers are sent. You can also analyze HTTP headers using Google Chrome DevTools.


Example response to a CDN request:

curl -I https://content.cstatic.io/assets/img/creoline-logo.svg

HTTP/2 200 
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
cache-control: max-age=31536000, public, s-maxage=86400, stale-if-error=86400, stale-while-revalidate=86400
access-control-allow-origin: *
x-creoline-engine: 4.0.1
x-creoline-original-size: 41946
x-creoline-cdn-host: content.cstatic.com
x-creoline-cdn-path: /assets/img/creoline-logo.svg
x-creoline-renderer: n.backend.cstatic.com
accept-ranges: bytes
age: 102348
x-creoline-cache: HIT
x-creoline-cache-lifetime: 86400
server: creoline
x-creoline-edge: FRANKFURT
x-creoline-edge-frontend: fra.de.eu.cstatic.com
x-creoline-edge-backend: b.fra.de.eu.cstatic.com


Response Headers


Cache-Control

The Cache-Control header controls the caching behavior of the edge server and the client.

Value Description
max-age Maximum time, in seconds, that the browser is allowed to serve the response from the cache.
s-maxage Maximum time, in seconds, that the CDN edge server is allowed to serve the response from the cache.
stale-if-error Maximum time in seconds that the CDN edge server may serve the response from the cache if the upstream server (target server) does not return a valid response.
stale-while-revalidate Maximum time in seconds that the CDN edge server may serve the response from the cache while a resource update is already in progress between the CDN edge server and the upstream server (target server).


x-creoline-edge-frontend

The Edge Frontend header provides information about which edge server delivered the static file. The selection of the nearest available server is handled by our Anycast DNS network.

The format is identical for all locations and follows this pattern:

Location, Country, Continent.cstatic.com

  • In this example: fra.de.eu.cstatic.com


x-creoline-cache

The cache header provides information about the current status of the CDN cache. The following values are possible:


HIT

The static file is already in the CDN cache and will be synchronized with the origin server at the earliest when the cache TTL (Expires header) is reached.


STALE

The cache TTL has been reached and exceeded. The static file continues to be served from the CDN cache despite the cache TTL having expired and will subsequently be updated in the background. Regardless of the set cache TTL, the cache for each static file is retained in STALE mode for 7 days after the TTL expires to ensure the best possible response times for low-traffic requests.


MISS

The static resource is not (yet) in the CDN cache and had to be downloaded from the origin server in parallel. As soon as the identical resource is requested again, the CDN returns a HIT.


content-type

The Content-Type header provides the actual MIME type of the response. Depending on the selected CDN setting, the Content-Type may differ from that of the actual source file.


x-original-content-type

The Original-Content-Type header returns the value of the original content. For example, if a JPG image is converted to a WebP image, image/jpg is returned here as the original value.


The Link response header can be used to prevent duplicate content. Example:

link: <https://www.creoline.de/assets/img/creoline-logo.svg>; rel="canonical"


Specifying the original source helps prevent duplicate indexing.



WebP Conversion

When converting to WebP images, the original URL with a .jpg or .png suffix remains unchanged to ensure backward compatibility with older browsers that do not support WebP. The x-converted and x-original-content-type headers return information about the conversion process and the original format.


Example response headers:

x-converted: image/jpeg to image/webp
x-original-content-length: 80000
x-original-content-type: image/jpeg
x-quality: 80


Automatic WebP conversion is controlled via the Accept HTTP header. In order for the original JPG or PNG image to be converted to WebP, the client must send the Accept header with the value image/webp. Otherwise, the original image is compressed as much as possible and returned to the client.