You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

express-back

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-back

Express-back tracks the previous page a user visited in sessions, allowing for reliable back one page redirects.


Version published
Maintainers
1
Created

Readme

Source

express-back

The http referer header is unreliable, express-back uses sessions to track the two previous paths a client has visited. Also provides a convienence method res.back() to safely redirect to the previous path or fallback as to prevent a redirect loop.

Usage


var back = require('express-back');

app.use(session({
  secret: 'super secret'
}));
app.use(back());

app.get('/protected', function(req, res) {
  if (!req.isAuthenticated()) {
    return res.back();
  }
});

API

var back = require('express-back');

This middleware depends upon a session middleware or req.session, and will populate req.prevPath and req.prevPrevPath.

back(options)
  • options {Object}
  • options.default {String} The fallback path to populate req.prevPath and req.prevPrevPath, defaults to '/'

Keywords

FAQs

Package last updated on 25 Jun 2016

Did you know?

Socket

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
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc