October 24, 2018

Cache headers

  Caching, Technical Reference


NuevoCloud determines what to cache by examining the cache headers in the response from your origin server.

Important: The cache headers from your server can be overridden using the Browser Cache Expiration and Edge Cache Expiration zone settings. You must set these two options to Respect Existing Headers or your server headers will have no effect.


The Surrogate-Control header is the first header NuevoCloud attempts to use. This header has the same options as Cache-Control, but is only used to control NuevoCloud's cache and is not sent to browsers.


Surrogate-Control: public, max-age=86400


If the Surrogate-Control header is not present, NuevoCloud will look for the Cache-Control header. This header also controls the visitors browser cache.


Cache-Control: max-age=3600, must-revalidate


max-age The maximum number of seconds the resource should be considered fresh.
s-max-age Similar to max-age, but only applies to shared caches.
NuevoCloud will use s-max-age (instead of max-age) if it's present.
If any of these options are present, NuevoCloud does not cache the resource.


Finally, if neither a Surrogate-Control or Cache-Control header is found, NuevoCloud will examine the Expires header.


Expires: Tue, 01 Jan 2030 00:00:00 GMT

Combining Headers

These options can be combined to control both NuevoCloud's cache and the visitors browser cache separately. For example, to cache a resource at the CDN edge for 24 hours, but not in a visitor's browser cache, you could use headers similar to this:

Surrogate-Control: max-age=86400
Cache-Control: no-cache
Expires: -1

In this example, you can take advantage of NuevoCloud's caching, but since the resource is never cached by the browser, when you purge a file from NuevoCloud, you can be sure all of your visitors are seeing the new file.

Cache headers are one of the most useful tools at your disposal to implement your cache policy.