Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

check-referer

0.0.3 • Public • Published

check-referer

Connect middleware for validating the refering domain of incoming requests. Checks the referer and origin headers to ensure browser requests are initiated from approved domains.

Example

var checkReferer = require('check-referer');
 
var checkRefererMw = ;
 
app.post('/api/endpoint', checkReferer('mydomain.com'), function(req, res) {
    // Requests from other platforms will return 403
    res.send('Hi!');
});
 
// You can also pass an array to allow multiple domains
checkReferer(['mydomain.com', 'anotherdomain.net']);

Install

npm i check-referer

DownloadsWeekly Downloads

0

Version

0.0.3

License

MIT

Last publish

Collaborators

  • avatar