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
|
2021-06-09 18:32:48 +03:00
|
|
|
// @TODO optimize this to reduce the number of redirects required to get to a pretty URL
|
2016-10-10 22:14:32 +03:00
|
|
|
// @TODO move this to being used by routers?
|
2018-09-20 16:03:33 +03:00
|
|
|
const slashes = require('connect-slashes');
|
2020-05-27 20:47:53 +03:00
|
|
|
const config = require('../../../../shared/config');
|
2016-10-10 22:14:32 +03:00
|
|
|
|
|
|
|
module.exports = [
|
|
|
|
slashes(true, {
|
|
|
|
headers: {
|
2018-09-20 16:03:33 +03:00
|
|
|
'Cache-Control': `public, max-age=${config.get('caching:301:maxAge')}`
|
2016-10-10 22:14:32 +03:00
|
|
|
}
|
|
|
|
}),
|
|
|
|
require('./uncapitalise')
|
|
|
|
];
|