Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

referrer-policy

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

referrer-policy

Middleware to set the Referrer-Policy HTTP header

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
403K
decreased by-2.62%
Maintainers
1
Weekly downloads
 
Created

What is referrer-policy?

The referrer-policy npm package is used to set the Referrer-Policy HTTP header in web applications. This header controls how much referrer information is included with requests made from your site.

What are referrer-policy's main functionalities?

Set Referrer-Policy Header

This feature allows you to set the Referrer-Policy header for your web application. In this example, the policy is set to 'no-referrer', which means that the Referer header will be omitted entirely.

const referrerPolicy = require('referrer-policy');
const express = require('express');
const app = express();

app.use(referrerPolicy({ policy: 'no-referrer' }));

app.get('/', (req, res) => {
  res.send('Referrer-Policy is set to no-referrer');
});

app.listen(3000, () => {
  console.log('Server is running on port 3000');
});

Multiple Policy Options

This feature allows you to choose from multiple policy options for the Referrer-Policy header. In this example, the policy is set to 'strict-origin-when-cross-origin', which means that full URL referrer information is sent for same-origin requests, but only the origin is sent for cross-origin requests.

const referrerPolicy = require('referrer-policy');
const express = require('express');
const app = express();

app.use(referrerPolicy({ policy: 'strict-origin-when-cross-origin' }));

app.get('/', (req, res) => {
  res.send('Referrer-Policy is set to strict-origin-when-cross-origin');
});

app.listen(3000, () => {
  console.log('Server is running on port 3000');
});

Other packages similar to referrer-policy

Keywords

FAQs

Package last updated on 03 May 2019

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc