Include custom response headers
This solution allows you to include headers you’d like returned alongside the response, as part of your request.
-
headers (optional, object) - Includes the provided headers in the response. Header should be written in Pascal-Case and cannot overwrite headers that would otherwise be present in the response (Except for Cache-Control).
const imageRequest = JSON.stringify({ bucket: "<myImageBucket>", key: "<myImage.jpeg>", headers: { "Cache-Control":"max-age=86400,public" "Custom-Header":"some-custom-value" } })
Note
A deny-list is maintained which restricts which headers can be included with this feature. Headers which may serve a purpose for the browser or are used to support authentication/authorization are included in this deny-list. For an exact list of the regular expressions which are restricted, visit constants.ts
The presence of the expires query parameter will cause the Cache-Control header to be overridden, regardless of any value provided in the headers field.
If your deployment is using the S3 Object Lambda Architecture , the headers at this link cannot be included as custom headers.