Skip to content

Techniques

curl Command#

The curl command is a useful tool for debugging website issues. The curl command allows you to make HTTP requests to a URL. By using the -svo /dev/null options, the output is suppressed and instead sent to the /dev/null file, which discards it.

Example:

curl -svo /dev/null www.example.com/index.html

Peakhour-Trace Header#

The peakhour-trace header is used to provide information about the processing of a website request. The header value is a comma-separated list of items to trace, such as waf, cache.

The below response header means the request was served from the Peakhour cache.

Peakhour-Trace: cache

Peakhour-ID Header#

The Peakhour-ID header is a unique identifier for a request that is used to aid in debugging and support. When reaching out to Peakhour support, it is useful to include this header in the request to help the support engineer track and debug the issue.

Age Header#

The Age header is used to represent the time elapsed in seconds since the response was generated by the origin server. This can be useful in debugging the response time of a request and determining if it was served from cache or if it was generated anew by the origin server. A value for the Age header indicates that the response was served from cache and was not generated anew by the origin server.

Age: 328579

means the response has been cached for around 90 minutes

How to diagnose and debug CDN requests using the Cache-Status header#

The Cache-Status header provides visibility into how multiple caching providers interact and handle a request.

Understanding the Cache-Status header#

The Cache-Status header is only applicable to responses directly generated by an origin server. It forms a list, with each member of the list representing a cache that has handled the request, with the last member in the list being the cache that was served most recently to the user.

Each member of the list can add an appropriate parameter indicating how it handled the request. The format of the Cache-Status header is a list, with each cache in the line separated by a ','.

The parameters of the Cache-Status header#

The following are the possible parameters of the Cache-Status header:#

  • hit = boolean: signifies that a request was satisfied by the cache. Its presence indicates a cache hit.
  • fwd = (bypass, method, uri-miss, vary-miss, request, stale, partial): indicates when a response was forwarded to an origin server and why.
  • fwd-status = integer: indicates what status code the next hop returned in response to the request.
  • ttl = integer: each cache item is associated with a time to live (TTL), indicating the remaining freshness of the resource.
  • stored = boolean: indicates whether the received response was stored by the cache.
  • collapsed = boolean
  • key = string
  • detail = token / string

Example usage#

A cache-status header will appear as follows:

Cache-Status: OriginCache; hit; ttl=1100, "CDN Company Here"; fwd=uri-miss;

An example of a cache hit with a freshness of 376 seconds:

Cache-Status: ExampleCache; hit; ttl=376

An example of a cache miss and the cache storing the response for the next hit:

Cache-Status: ExampleCache; fwd=uri-miss;...

With the Cache-Status header, it is possible to see at a glance how a request was handled by various caches, making it easier to diagnose and debug CDN requests.