Deprecated
Feature-Policy
has been added to Helmet,
so please use koa-helmet to add this
header (and lots of other great security header fixes) to your Koa apps.
Small library for adding a Feature-Policy
to Koa responses.
IMPORTANT Feature-Policy
is experimental, so this library might change
frequently until the new header is stable.
npm i koa-feature-policy
import featurePolicy from 'koa-feature-policy'
// set up koa
const options = {
/* directive: allowlist */
vibrate: ["'self'", 'https://example.com']
}
app.use(featurePolicy(options))
// call app.listen
See MDN for the full list of directives.
This library converts camelCase
directives to lisp-case
. So use
ambientLightSensor
, not 'ambient-light-sensor'
.