In this section, you add security headers to the responses that your CloudFront distribution returns to viewers. CloudFront response headers policies let you do this without changing the origin and without writing Lambda@Edge or CloudFront Functions code.


SecurityHeadersPolicy is an AWS managed policy that adds headers such as Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, X-XSS-Protection and Referrer-Policy. CloudFront always adds X-Content-Type-Options: nosniff, even if the origin response already contains this header. For the other headers in the policy, if the origin response already contains the header, CloudFront keeps the origin’s header and value instead of the one in the policy.
