Infrastructure Security

A CloudFront distribution must return a centrally defined Strict-Transport-Security value on HTTPS responses, including cache hits, even when an origin returns a different value. Which configuration BEST meets this requirement without changing the origins?

Show the answer

Correct answerB. Attach a response headers policy with HSTS configured and origin override enabled.

AWhy not this: An origin request policy controls requests sent to origins, not security headers returned to viewers.

BWhy this is right: Origin override makes the configured HSTS value take precedence on viewer responses, including cache hits.

CWhy not this: With origin override disabled, an existing origin HSTS value takes precedence over the policy value.

DWhy not this: A cache policy controls cache keys and forwarding behavior; it does not set the required viewer response header.

A CloudFront response headers policy applies to viewer responses, including cache hits. Enabling origin override makes CloudFront use the policy's HSTS value instead of a conflicting origin value; disabling it preserves the origin's value when present.