How is X-Cache-Invalidate used?

I’ve been trying to understand the general CDN caching story around Ghost. For some hosted Ghost installs I noticed that the max-age is quite high, and was concerned that this may cause stale pageloads. However, I see in the sourcecode that there are large amounts of X-Cache-Invalidate header usage, presumably to invalidate previously cached pages. However, I’m unsure about how that header is being used. Is it some middleware that handles it that I’m missing? I know that something must intercept that header value and process it, but I’m unsure if that is the CDN itself or some Express middleware that is optionally configured that calls out to the CDN host to invalidate.

I’ve searched on Google for the string “X-Cache-Invalidate” but could not find any documentation on this header, it does not seem very common.

@gnalck the header is custom to Ghost, we use it on Ghost(Pro)'s caching layer due to the particular way that works but it’s there and available for anyone else implementing more advanced caching.

Generally Ghost doesn’t use particularly long cache expiration times for content outside of assets, in most cases it won’t set any cache headers. Assets are an exception because Ghost doesn’t allow overwriting of uploaded assets and theme assets are always served with a cache-busting query param so it makes sense to maximise cache usage there.

If you are seeing high max-age values it’s most likely coming from the proxy server in front of Ghost (nginx in the default ghost-cli setup) rather than Ghost itself and is up to the site owner to configure to their needs.

Makes sense, @Kevin. Thanks for your response!