Nonstop Progressive Marxism
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

koa-redirect-loop

0.0.3 • Public • Published

koa-redirect-loop

build status code coverage code style styled with prettier made with lass license npm downloads

Prevent redirect loops with sessions since HTTP referrer header is unreliable

Note that this package only supports koa-generic-session, since other packages do not expose a save method used in res.end override.

Table of Contents

Install

npm:

npm install koa-redirect-loop

yarn:

yarn add koa-redirect-loop

Usage

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

  • defaultPath (String) - path to fallback to, defaults to '/'
  • maxRedirects (Number) - maximum number of redirects to allow, defaults to 5

Contributors

Name Website
Nick Baugh http://niftylettuce.com/

License

MIT © Nick Baugh

Install

npm i koa-redirect-loop

DownloadsWeekly Downloads

22

Version

0.0.3

License

MIT

Unpacked Size

16.6 kB

Total Files

11

Last publish

Collaborators

  • avatar