Bypass Headers

If you want to bypass the Stellate Edge Cache for specific requests you need to define a set of Bypasse Cache Headers and then include them in your GraphQL request.

To configure those headers you can use the configuration file and the bypassCacheHeaders field that accepts a list of headers to look for.

import { Config } from 'stellate';

const config: Config = {
  config: {
    name: "my-app",
    schema: "",
    originUrl: "",
    bypassCacheHeaders: [
        { name: "x-preview-token" },
        { name: "some-other-token" }


A sample query using a Bypass Cache Header can be seen below

curl --request POST \
  --url \
  --header 'Content-Type: application/json' \
  --header 'x-preview-token: 1' \
  --data '{"query":"{ launchesPast(limit: 5) { mission_name launch_date_utc launch_site { site_id site_name site_name_long } } }"}'

If you then take a look at the response headers for that request you will find the following headers indicating the request was passed on to your origin service.

gcdn-cache: PASS
gcdn-passed-through-request: "bypass-cache-header:x-preview-token"

The gcdn-passed-through-request response header will indicate which bypass header was used in the request.


Bypass Cache Headers and currently cached responses

This feature relies on the Vary header, which is stored with cached responses.

Since we can not update this header for stored responses, changes you make to your Bypass Cache Headers configuration will not apply to cached responses until they either get purged or expire.


You can also use Bypass Cache Headers on your mutations. In that case, they will bypass the Automatic Cache Invalidation via Mutations, which can be helpful in certain situations.


If you bypass automatic cache invalidation, make sure you have other means in place to purge updated data from the cache, or that you are ok with stale data for those queries.

Did this page help you?