Skip to main content

Bypassing Cache with HTTP Headers

Set HTTP headers to disable caching along Pantheon's edge layer, Varnish.


Exclude Specific Pages from Caching

You can use a variety of mechanisms to determine which responses from your Drupal or WordPress site should be excluded from caching. Ultimately, these mechanisms result in setting HTTP headers that signal cacheability to Varnish and recipients of the response, like a browser.

Information:
Agency WebOps Training

Agency WebOps Training

Learn industry best practices for caching, how to take advantage of them on the platform, and troubleshooting common issues with help from the experts at Pantheon.

Learn more

Some web developers choose to aggregate all of their caching logic in one place, often the settings.php file of Drupal or a plugin dedicated to site-specific functionality in WordPress (as shown in the examples below). Alternatively, you can spread out cache-related code so that it is closest to the elements (i.e. sidebars, footers) that cause the cacheability of the response to be limited.

As an alternative to using HTTP headers to control downstream caching, you can set a NO_CACHE cookie. For details, see Working with Cookies on Pantheon.

Warning:
Warning

Pantheon does not support manually editing and updating the VCL on Global CDN. We use a standard VCL for all sites on the platform. Requests are accepted, but we do not guarantee change requests will be implemented. To submit a request for Global CDN, open a Support Ticket.

Note some customizations to VCL are available via Advanced Global CDN. For more information, Contact Sales.

Test Pages Excluded from Cache

To test whether or not a page is being served from Pantheon's edge caching layer, examine the headers output (Age, Cache-Control, Set-Cookie) via the following curl command:

The Cache-Control header in this example instructs Pantheon's edge caching layer (Varnish) not to cache the response for this request. If you run the command again, you should continue to see Age: 0 for excluded pages. For more details, see Testing Global CDN Caching.

More Resources