Every line of 'express headers' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
6 function secureHeaders (app, frontendApp) { 7 // Content Security Policy 8 app.use(helmet.contentSecurityPolicy({ 9 directives: { 10 defaultSrc: ["'none'"], 11 // Allow
38 public getHeader(field: string): string | undefined { 39 return this.req.header(field); 40 }
88 addCustomHeaders(customHeaders?: ICustomHeader[]) { 89 if (customHeaders) { 90 this.addUse(null, (req, res, next) => { 91 customHeaders.forEach((customHeader) => { 92 let value: string | undefined = customHeader.value.toString(); 93 if (customHeader.isEnv && value && process.env[value]) { 94 value = process.env[value]; 95 } 96 res.header(customHeader.key, value); 97 }); 98 next(); 99 }); 100 } 101 }