2016-10-10 22:14:32 +03:00
|
|
|
// 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?
|
|
|
|
var slashes = require('connect-slashes'),
|
2017-12-06 19:37:54 +03:00
|
|
|
config = require('../../config');
|
2016-10-10 22:14:32 +03:00
|
|
|
|
|
|
|
module.exports = [
|
|
|
|
slashes(true, {
|
|
|
|
headers: {
|
2017-10-12 15:36:50 +03:00
|
|
|
'Cache-Control': 'public, max-age=' + config.get('caching:301:maxAge')
|
2016-10-10 22:14:32 +03:00
|
|
|
}
|
|
|
|
}),
|
|
|
|
require('./uncapitalise')
|
|
|
|
];
|