Analyze CDN response header

In this article you will find out which HTTP headers are set for the CDN responses and what they mean.


In this example, we use curl to show which headers are sent. The HTTP headers can also be analyzed using the Google Chrome Dev Tools.


Example response of a CDN request:

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

HTTP/2 200
date: Wed, 15 Sep 2021 08:50:14 GMT
content-type: image/svg+xml
content-length: 2658
vary: Accept-Encoding
server: creoline
cache-control: max-age=31536000, public
etag: 0f137075a689c1efd273c3b99a09e8cd
expires: Thu, 15 Sep 2022 08:50:12 GMT
last-modified: Tue, 14 Jul 2020 19:21:24 GMT
link: <https://www.creoline.de/assets/img/creoline-logo.svg>; rel="canonical"
access-control-allow-origin: *
x-content-type-options: nosniff
x-cache-date: Wed, 15 Sep 2021 08:50:12 GMT
x-edge-pop: FRANKFURT
x-cache: HIT


Response Header

x-edge-pop

The Edge PoP header provides information about which PoP server was used to deliver the static file. The next possible server is selected via our Anycast DNS network. \n

The scheme is identical for all locations and is based on the following scheme:

  • Continent - Country - City - Location number
  • In this example: EU-DE-FRANKFURT-01


x-edge-ip

The Edge IP serves as additional information to the location information from the x-edge-pop header. Note that the Edge IP address can also be different at the same location.


x-cache-date

The date of the initial cache creation of this static file is returned via the "Cache-Date" header.

All time stamps of the HTTP headers are always specified in GMT and must be converted for German time depending on the current time zone (CET, GMT+1 or CEST GMT+2).


x-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 is synchronized with the target 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 delivered by the CDN cache despite the cache TTL being exceeded and is then updated in the background. Regardless of the set cache TTL, the cache for each static file is kept in STALE mode for 7 days after the TTL expires in order to ensure the best possible response times with few calls.



MISS

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


content-type

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


x-original-content-type

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


Duplicated content can be avoided with the help of the link response header. Example:

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


Double indexing can be avoided by specifying the original source.



WebP conversion

When converting to WebP graphics, the original URL with a .jpg or .png suffix is not changed in order to ensure backward compatibility with older browsers without WebP support. The conversion process and the original format are returned via the x-converted and x-original-content-type headers.


Example response header:

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


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