http-security-headers
Applies best practice security headers to responses. It's a simplified port of HelmetJS. See HelmetJS documentation for more details.
Install
To install this middleware you can use NPM:
npm install --save @middy/http-security-headers Features
dnsPrefetchControlcontrols browser DNS prefetchingframeOptionsto prevent clickjackingpoweredByto remove the Server/X-Powered-By headerstrictTransportSecurityfor HTTP Strict Transport SecuritydownloadOptionssets X-Download-Options for IE8+contentTypeOptionsto keep clients from sniffing the MIME typereferrerPolicyto hide the Referer headerxssProtectionsetsX-XSS-Protection: 0to disable the legacy browser XSS filter
Options
There are a lot, see source
Sample usage
import middy from '@middy/core'
import httpSecurityHeaders from '@middy/http-security-headers'
const lambdaHandler = (event, context) => {
return {}
}
export const handler = middy().use(httpSecurityHeaders()).handler(lambdaHandler) Last updated: