This message appears when there are no Cache-Control
HTTP headers in the response from the operation. These are set in Apollo Server via the @cacheControl
directive.
To use the @cacheControl
directive, you must add the following definitions to your server's schema:
enum CacheControlScope {
PUBLIC
PRIVATE
}
directive @cacheControl(
maxAge: Int
scope: CacheControlScope
inheritMaxAge: Boolean
) on FIELD_DEFINITION | OBJECT | INTERFACE | UNION
Whenever Apollo Server sends an operation response that has a non-zero maxAge
, it includes a Cache-Control HTTP header that describes the response's cache policy.
The header has this format: Cache-Control: max-age=60, private
If you run Apollo Server behind a CDN or another caching proxy, you can configure it to use this header's value to cache responses appropriately.
You can find more information on caching here.
Comments
0 commentsPlease sign in to leave a comment.