Content security policy middleware for PXE.js.
Install @pxe/csp
.
# NPM
npm i @pxe/csp
# Yarn
yarn add @pxe/csp
These are all @pxe/csp
declarations.
CSP
options?: CSP.Options
: The CSP header options.Create a CSP middleware.
csp.invoke
ctx: Server.Context
: The server contextnext: Server.NextFunction
: Call the next middleware...args: any[]
: The previous middleware passed argumentsThe callback of the middleware. This can be used as a middleware:
app.use(csp.invoke.bind(csp));
// Or shorter
app.use(csp);
FetchDirective
"child" | "connect" | "font" | "frame" | "img" | "manifest" | "media" | "object" | "prefetch" | "script" | "style" | "worker"
All basic fetch directives.
SrcValue
boolean | string | string[]
The value of any key in options.src
.
Options
The CSP options.
options.report
string
The report URI.
options.src
{ [key in FetchDirective]?: SrcValue } & { [key: string]: SrcValue }
This object contains all fetch directives.