ETag / Cache-Control headers on Strapi REST API


I am looking for ways to add some simple HTTP caching behaviour to a Strapi REST API. For instance, how could I:

  • add a Cache-Control header in responses (e.g. public)
  • generate and set ETag headers in responses
  • respond 304 Not Modified when an If-None-Match header is provided

The goals would be to optimise the end user experience and reduce the load on the server.

Any suggestion will be appreciated :slightly_smiling_face:

A new Strapi user

This topic has been created from a Discord post (1256552150226698281) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord


So, I talking from top of my head, so maybe something is not accurate, but for: the Cache-Con

Yep the middleware is way to go