headers property
Headers that you want CloudFront to return in the generated response. Note the following:
- The keys in the
headersobject are lowercase versions of standard HTTP header names. Using lowercase keys gives you case-insensitive access to the header values. - Each header (for example,
headers["accept"]orheaders["host"]) is an array of key-value pairs. For a given header, the array contains one key-value pair for each value in the generated response.key(optional) is the case-sensitive name of the header as it appears in an HTTP request; for example,acceptorhost.
- Specify
valueas a header value. - If you do not include the header key portion of the key-value pair,
Lambda@Edgewill automatically insert a header key using the header name that you provide. Regardless of how you've formatted the header name, the header key that is inserted automatically will be formatted with initial capitalization for each part, separated by hyphens (-).
For example, you can add a header like the following, without a header key: 'content-type': [{ value: 'text/html;charset=UTF-8' }]
In this example, Lambda@Edge creates the following header key: Content-Type.
Implementation
late final CloudFrontHeaders headers;