Package Exports
- express-redirect-loop
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 (express-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
express-redirect-loop
Prevent redirect loops with sessions since HTTP referrer header is unreliable
Table of Contents
Install
npm:
npm install express-redirect-loopyarn:
yarn add express-redirect-loopUsage
const express = require('express');
const session = require('express-session');
const redirectLoop = require('express-redirect-loop');
const app = express();
app.use(
session({
secret: 'test',
resave: false,
saveUninitialized: true
})
);
app.use(redirectLoop({
defaultPath: '/',
maxRedirects: 5
}));
app.get('/', (req, res) => res.sendStatus(200));
app.get('/bar', (req, res) => res.redirect('/foo'));
app.get('/foo', (req, res) => res.redirect('/foo'));
app.get('/baz', (req, res) => res.redirect('/bar'));
app.listen(3000);Contributors
| Name | Website |
|---|---|
| Nick Baugh | http://niftylettuce.com/ |