UNPKG

@reldens/server-utils

Version:
41 lines (35 loc) 1.15 kB
/** * * Reldens - ServerHeaders * */ class ServerHeaders { constructor() { this.http2SecurityHeaders = { 'x-content-type-options': 'nosniff', 'x-frame-options': 'DENY' }; this.http2VaryHeader = 'Accept-Encoding, Origin'; this.http2CorsMethods = 'GET, OPTIONS'; this.http2CorsHeaders = 'Content-Type'; this.expressSecurityHeaders = { 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'DENY' }; this.expressVaryHeader = 'Accept-Encoding'; this.expressCacheControlNoCache = 'no-cache, no-store, must-revalidate'; this.expressCacheControlPublic = 'public, max-age={maxAge}, immutable'; this.expressPragma = 'no-cache'; this.expressExpires = '0'; this.proxyForwardedFor = 'X-Forwarded-For'; this.proxyForwardedProto = 'X-Forwarded-Proto'; this.proxyForwardedHost = 'X-Forwarded-Host'; } buildCacheControlHeader(maxAge) { return this.expressCacheControlPublic.replace('{maxAge}', maxAge); } } module.exports.ServerHeaders = ServerHeaders;