Made members JWKS endpoint caching configurable

refs https://github.com/TryGhost/Toolbox/issues/411
refs f58b5984cb

- 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 change only changes the members endpoint caching configurability. The other JWKS endpoint will be modified separately (following commit), to keep changes concise
This commit is contained in:
Naz 2022-09-27 14:30:13 +08:00 committed by naz
parent 5331ba3999
commit 8c47819194
2 changed files with 4 additions and 1 deletions

View File

@ -94,7 +94,7 @@ module.exports = function setupSiteApp(routerConfig) {
// /member/.well-known/* serves files (e.g. jwks.json) so it needs to be mounted before the prettyUrl mw to avoid trailing slashes
siteApp.use(
'/members/.well-known',
shared.middleware.cacheControl('public', {maxAge: constants.ONE_DAY_S}),
shared.middleware.cacheControl('public', {maxAge: config.get('caching:wellKnown:maxAge')}),
(req, res, next) => membersService.api.middleware.wellKnown(req, res, next)
);

View File

@ -126,6 +126,9 @@
"robotstxt": {
"maxAge": 3600000
},
"wellKnown": {
"maxAge": 86400
},
"cors": {
"maxAge": 86400
}