Skip to content

HTTP Headers

HTTP headers help communicate the cacheability of content to FastQL and other clients. FastQL also adds headers to help you troubleshoot caching and improve your hit rate.

X-Cache Headers

When making a GraphQL request to FastQL, you'll see additional headers added to the request:

X-Cache: this header indicates whether the content was served from the origin server, or if it was cached on the edge that your request was served from. There are four possible values:

  • PASS from FastQL: this response indicates that the request was not eligible for caching. This could be due to the contents of the request (ie, mutation or invalid GraphQL syntax) or due to an origin Cache-Control header indicating that the request shouldn't be cached.
  • MISS from FastQL: this means that the specific request was not previously cached at the edge location, or was evicted due to expiration or explicit eviction.
  • PARTIAL from FastQL: this indicates that some of the query was previously cached, but not all of it, and that the origin server was contacted for the results.
  • HIT from FastQL: this query was returned directly from cache and no request was made to the origin server.

X-Cache-Fql: this is an additional header only included in cache hits. It's value is a comma separated list of hashes that could be used for manual cache invalidation with the FastQL API.

Origin Cache-Control Headers

The origin GraphQL server can include Cache-Control headers that indicate to FastQL that a query and response should not be cached, and also, how long to keep the item in cache before evicting it.

Disable Caching

The origin should add a Cache-Control header with values that include private or no-cache to indicate that this query should not be cached. Read more about Cache-Control.

TTL

The TTL (time to live) is the number of seconds that request should be cached before being evicted. The origin server can include an s-maxage=<seconds> or max-age=<seconds> to set the TTL. The minimum TTL is 1 hour for for standard plans, and 30 seconds for Enterprise plans.