Skip to content
Middleware for setting the Feature-Policy HTTP response header
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
index.js
package-lock.json
package.json

README.md

Feature Policy

Build Status

Looking for a changelog?

This is Express middleware to set the Feature-Policy header. You can read more about it here and here.

To use:

const featurePolicy = require('feature-policy')

// ...

app.use(featurePolicy({
  features: {
    fullscreen: ["'self'"],
    vibrate: ["'none'"],
    payment: ['example.com'],
    syncXhr: ["'none'"]
  }
}))

The following features are currently supported:

  • geolocation
  • midi
  • notifications
  • push
  • syncXhr
  • microphone
  • camera
  • magnetometer
  • gyroscope
  • speaker
  • vibrate
  • fullscreen
  • payment
  • accelerometer
  • usb
  • vr
  • autoplay
You can’t perform that action at this time.