Very similar to the unmaintained project express-uncapitalize, this middleware redirects any requests which contain uppercase chars to their lowercase forms. With two main changes from the original:
- Works with all utf-8 strings in paths
- Keeps query parameters intact
npm install express-lowercase-paths-with-status-code
var lowercasePaths = require("express-lowercase-paths-with-status-code")
app.use(lowercasePaths())
To redirect with a specific status code, pass the redirectStatusCode
option to the middleware:
var lowercasePaths = require("express-lowercase-paths-with-status-code")
app.use(lowercasePaths({redirectStatusCode: 301}))