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']);

/check-referer/

    Package Sidebar

    Install

    npm i check-referer

    Weekly Downloads

    1

    Version

    0.0.3

    License

    MIT

    Last publish

    Collaborators

    • download