Hi guys, I’m new in strapi, wanted to ask on how should I set up the cache-control in strapi? Right now I have this /config and inside of it is middleware.js, plugin.js, etc.
Front-end: NextJS 14 | Typescript
My goal is to cache the images from strapi for a month, I’m already fetching data from strapi but the images isn’t cached for a month it has a max-age of 3600
I tried using the rest-cache plugin but it didn’t work.
My middleware.js right now is:
module.exports = [ 'strapi::logger', 'strapi::errors', 'strapi::security', 'strapi::cors', 'strapi::poweredBy', 'strapi::query', 'strapi::body', 'strapi::session', 'strapi::favicon', 'strapi::public', ];
in my plugin.js:
upload: { config: { providerOptions: { localServer: { maxage: 2629746000 }, }, }, },
‘rest-cache’: {
config: {
provider: {
name: ‘memory’,
getTimeout: 500,
options: {
// The maximum size of the cache
max: 32767,
// Update to the current time whenever it is retrieved from cache, causing it to not expire
updateAgeOnGet: false,
// …
},
},
strategy: {
keysPrefix: ‘undetectable-ai’,
maxAge: 86400,
debug: true,
contentTypes: [ /** … */ ],
},
},
}
This topic has been created from a Discord post (1276406175818059816) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord