title: Cache HTTP response despite "no-cache" header in response
body: <p>My backend is making requests to a third-party REST API. I wish to cache requests to avoid hitting their rate limit. However, the third-party API is returning headers which instruct my caching layer (RFC 7234 compliant) not to cache. Is there any standards compliant way to instruct my caching layer to ignore directives provided in the response?</p>
  
  <p>My backend is in Node.js and the caching layer I've tried is <a href="https://github.com/lukechilds/cacheable-request" rel="nofollow noreferrer">cacheable-request</a>. I'm making requests with <code>Cache-Control: public, max-stale=900</code> header with the intention of allowing stale data to be served for 15 minutes. This works if I invoke an API which returns no cache-related response headers. However the real third-party API returns the following headers:</p>
  
  <pre><code>cache-control: no-store, no-cache, must-revalidate
  expires: Thu, 01 Jan 1970 00:00:00 UTC
  date: Wed, 12 Jun 2019 13:53:07 GMT
  pragma: no-cache
  vary: Accept-Encoding
  </code></pre>
  
  <p>And this seems to prevent my caching layer from kicking in.</p>
  
  <p>The solution needs to be redundant and deploy-able in Kubernetes. I'm okay serving stale data as long as I can invalidate it whenever users make mutations or I receive an event hook from the third-party. I expect to find a solution which is fairly generic and does not require me to truly replicate and persist the third-party data structure in my own backend.</p>