mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05: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
2 changed files with 5 additions and 1 deletions
|
@ -3,6 +3,7 @@ const boolParser = require('express-query-boolean');
|
||||||
const bodyParser = require('body-parser');
|
const bodyParser = require('body-parser');
|
||||||
const express = require('../../../../../shared/express');
|
const express = require('../../../../../shared/express');
|
||||||
const sentry = require('../../../../../shared/sentry');
|
const sentry = require('../../../../../shared/sentry');
|
||||||
|
const config = require('../../../../../shared/config');
|
||||||
const shared = require('../../../shared');
|
const shared = require('../../../shared');
|
||||||
const routes = require('./routes');
|
const routes = require('./routes');
|
||||||
const errorHandler = require('@tryghost/mw-error-handler');
|
const errorHandler = require('@tryghost/mw-error-handler');
|
||||||
|
@ -22,7 +23,7 @@ module.exports = function setupApiApp() {
|
||||||
|
|
||||||
// Content API should allow public caching
|
// Content API should allow public caching
|
||||||
apiApp.use(shared.middleware.cacheControl('public', {
|
apiApp.use(shared.middleware.cacheControl('public', {
|
||||||
maxAge: 0
|
maxAge: config.get('caching:contentAPI:maxAge')
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Routing
|
// Routing
|
||||||
|
|
|
@ -131,6 +131,9 @@
|
||||||
},
|
},
|
||||||
"cors": {
|
"cors": {
|
||||||
"maxAge": 86400
|
"maxAge": 86400
|
||||||
|
},
|
||||||
|
"contentAPI": {
|
||||||
|
"maxAge": 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"imageOptimization": {
|
"imageOptimization": {
|
||||||
|
|
Loading…
Add table
Reference in a new issue