mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-04 08:54:36 +03:00
Made Content API caching configurable
refs https://github.com/TryGhost/Toolbox/issues/411 - Having hardcoded cache control values in the codebase makes it impossible to experiment with new values without a version release. - Having all values configurable by default will allow for easier caching experiments and customizations on self-hosting instances.
This commit is contained in:
parent
e45eb4d5dd
commit
874d0bf81b
@ -3,6 +3,7 @@ const boolParser = require('express-query-boolean');
|
||||
const bodyParser = require('body-parser');
|
||||
const express = require('../../../../../shared/express');
|
||||
const sentry = require('../../../../../shared/sentry');
|
||||
const config = require('../../../../../shared/config');
|
||||
const shared = require('../../../shared');
|
||||
const routes = require('./routes');
|
||||
const errorHandler = require('@tryghost/mw-error-handler');
|
||||
@ -22,7 +23,7 @@ module.exports = function setupApiApp() {
|
||||
|
||||
// Content API should allow public caching
|
||||
apiApp.use(shared.middleware.cacheControl('public', {
|
||||
maxAge: 0
|
||||
maxAge: config.get('caching:contentAPI:maxAge')
|
||||
}));
|
||||
|
||||
// Routing
|
||||
|
@ -131,6 +131,9 @@
|
||||
},
|
||||
"cors": {
|
||||
"maxAge": 86400
|
||||
},
|
||||
"contentAPI": {
|
||||
"maxAge": 0
|
||||
}
|
||||
},
|
||||
"imageOptimization": {
|
||||
|
Loading…
Reference in New Issue
Block a user