Package Exports
- koa-redirect-loop
- koa-redirect-loop/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (koa-redirect-loop) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
koa-redirect-loop
Prevent redirect loops with sessions since HTTP referrer header is unreliable and ensures sessions are saved upon redirect
Note that this package only supports
koa-generic-session, since other packages do not expose a save method used inres.endoverride.
Table of Contents
Install
npm:
npm install koa-redirect-loopUsage
const Koa = require('koa');
const session = require('koa-generic-session');
const RedirectLoop = require('koa-redirect-loop');
const redirectLoop = new RedirectLoop({
defaultPath: '/',
maxRedirects: 5,
logger: console
});
const app = new Koa();
app.keys = [ 'secret' ];
app.use(session());
app.use(redirectLoop.middleware);Options
getDefaultPath(Function) - function which acceptsctxargument and returns a path to fallback to, defaults to either/${ctx.request.locale}(e.g. if using@ladjs/i18n) or/defaultPath(String) - path to fallback to, defaults to'/'maxRedirects(Number) - maximum number of redirects to allow, defaults to5console(Object) - a logger instance, defaults toconsole
Contributors
| Name | Website |
|---|---|
| Nick Baugh | http://niftylettuce.com/ |