Socket
Socket
Sign inDemoInstall

koa-redirect-loop

Package Overview
Dependencies
5
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    koa-redirect-loop

Prevent redirect loops with sessions since HTTP referrer header is unreliable and ensures sessions are saved upon redirect


Version published
Weekly downloads
37
increased by60.87%
Maintainers
3
Install size
103 kB
Created
Weekly downloads
 

Readme

Source

koa-redirect-loop

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

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 in res.end override.

Table of Contents

Install

npm:

npm install 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

  • getDefaultPath (Function) - function which accepts ctx argument 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 to 5
  • console (Object) - a logger instance, defaults to console

Contributors

NameWebsite
Nick Baughhttp://niftylettuce.com/

License

MIT © Nick Baugh

Keywords

FAQs

Last updated on 21 Nov 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc