Socket
Socket
Sign inDemoInstall

dns-prefetch-control

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dns-prefetch-control

Middleware to set X-DNS-Prefetch-Control header.


Version published
Weekly downloads
144K
decreased by-3.78%
Maintainers
1
Weekly downloads
 
Created

What is dns-prefetch-control?

The dns-prefetch-control npm package is used to control browser DNS prefetching, which can help improve privacy and security by preventing the browser from prefetching DNS for links on a webpage. This can be particularly useful in mitigating certain types of attacks and reducing unnecessary DNS lookups.

What are dns-prefetch-control's main functionalities?

Disable DNS Prefetching

This feature allows you to disable DNS prefetching for your web application. By setting `allow` to `false`, the package will add the appropriate HTTP headers to prevent the browser from prefetching DNS for links on the page.

const dnsPrefetchControl = require('dns-prefetch-control');
const express = require('express');
const app = express();

app.use(dnsPrefetchControl({ allow: false }));

app.get('/', (req, res) => {
  res.send('DNS prefetching is disabled');
});

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

Enable DNS Prefetching

This feature allows you to enable DNS prefetching for your web application. By setting `allow` to `true`, the package will add the appropriate HTTP headers to allow the browser to prefetch DNS for links on the page.

const dnsPrefetchControl = require('dns-prefetch-control');
const express = require('express');
const app = express();

app.use(dnsPrefetchControl({ allow: true }));

app.get('/', (req, res) => {
  res.send('DNS prefetching is enabled');
});

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

Other packages similar to dns-prefetch-control

Keywords

FAQs

Package last updated on 13 Jan 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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc