Skip to content

Instantly share code, notes, and snippets.

@OrionStark
Created February 11, 2020 07:25
Show Gist options
  • Save OrionStark/2a128c07d155520727c53a0a4e73f5a2 to your computer and use it in GitHub Desktop.
Save OrionStark/2a128c07d155520727c53a0a4e73f5a2 to your computer and use it in GitHub Desktop.
function __addSecureAndCacheHeaders(res) {
// OWASP Secure Headers
res.set('X-Content-Type-Options', 'nosniff')
res.set('X-XSS-Protection', '1; mode=block')
res.set('X-Frame-Options', 'DENY')
res.set('Strict-Transport-Security', 'max-age=63072000; includeSubDomains')
// Avoid Caching Tokens
res.set('Cache-Control', 'no-cache, no-store, must-revalidate')
res.set('Pragma', 'no-cache')
res.set('Expires', '0')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment