A Cloudfront Lambda@Edge function for adding security headers.
npm install @aligent/cdk-cloudfront-security-headersThis package contains a Lambda@Edge function for Cloudfront to add security headers to the origin response of all requests.
The function is intended to be added to an existing Cloudfront.
- max-age= (seconds):
- Time is set to 108000s seconds / 30 hours. Specifies the length of time the browser should remember that site can only be accessed using HTTPS
- includeSubdomains (boolean, optional):
- Option is specifcied. The rule will apply to all of the site's subdomains
- preload (boolean, optional):
- Option is specificed. The will be preloaded into the HSTS Preload List.
- The Preload List is a list built into major web browsers like Chromium, Edge and Firefox. It is a list containing domains that HTTPS enforcement is automatically applied _before_ the browser receives the STS header.
- This soves the first-load problem of a browser not knowing a site's HSTS policy before the user has visited the site for a first time.
__CONTENT_SECURITY_POLICY__:index.ts. See Usage and Default Options above.Content-Type headers should be respected and not changed.nosniff (boolean):style and the MIME type is not test/css or of type script and the MIME type is not a JavaScript MIME type., , or . Helps to avoid clickjacking attacks by ensuring content is not embedded into other sites.DENY(boolean, optional):- SAMEORIGIN(boolean, optional):
- The page can only be displayed if all ancestor frames are same origin to the page itself.