Ghost/core/server/web/shared/middlewares/pretty-urls.js
Rishabh Garg fcd275f6c0 Refactored web/middleware and web/utils to web/shared (#9892)
refs #9866

- Moved web/middleware to web/shared/middlewares
- Moved util file to web/shared/utils
2018-09-20 20:04:34 +02:00

20 lines
628 B
JavaScript

// Pretty URL redirects
//
// These are two pieces of middleware that handle ensuring that
// URLs get formatted correctly.
// Slashes ensures that we get trailing slashes
// Uncapitalise changes case to lowercase
// @TODO optimise this to reduce the number of redirects required to get to a pretty URL
// @TODO move this to being used by routers?
const slashes = require('connect-slashes');
const config = require('../../../config');
module.exports = [
slashes(true, {
headers: {
'Cache-Control': `public, max-age=${config.get('caching:301:maxAge')}`
}
}),
require('./uncapitalise')
];