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.
CSPoptions?: CSP.Options: The CSP header options.Create a CSP middleware.
csp.invokectx: 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.
SrcValueboolean | string | string[]The value of any key in options.src.
OptionsThe CSP options.
options.reportstringThe report URI.
options.src{ [key in FetchDirective]?: SrcValue } & { [key: string]: SrcValue }This object contains all fetch directives.