Important note: v1.0.0 is now compliant with koa@2. If you use koa < 2, install koa-sanitize-uri 0.1.x
koa-sanitize-uri is a KOA middleware to sanitize request uri.
Request URI are checked. If they have a bad format, the middleware throw a redirect to the good uri with a 301 status (by default).
It's basically a good practice to keep consistant with URI and have only one URI per page content. It's aim is to avoid duplicate content (same content on 2 URI).
Read the CHANGELOG
;;const app= ;app;// ...app;
All options at once:
You can give the middleware an option to ignore file or paths matching regex.
Example with one regex:
Example with multi regex:
You can pass all the sanitizer options with the key sanitize`
Installing dev dependencies, you can edit the package source. Then run:
npm run dev-compilefor babel transpilation
npm run dev-checkfor eslint check