Is it possible to have custom headers on Amazon S3 with arbitrary naming?
For example, I am using a CDN pointing to Amazon S3 as the origin server, and in order to enable advanced functionality on the CDN I need to use a custom header x-something-something
...
I see it's possible to do this with x-amz-meta-(something)
but what about something more general like x-(something)-(something)
without the amz
?
These custom headers enable you to send and gather information from your origin that you don't get with typical viewer requests. These headers can even be customized for each origin. CloudFront supports custom headers for both for custom and Amazon S3 origins. Topics.
As far as I know there is no way to set custom headers at the ALB level. You can however add CloudFront as a CDN in front of it, that allows you to set custom headers, which will then be passed on to the ALB.
Select the web site where you want to add the custom HTTP response header. In the web site pane, double-click HTTP Response Headers in the IIS section. In the actions pane, select Add. In the Name box, type the custom HTTP header name.
This beautiful article explains it all https://medium.com/@tom.cook/edge-lambda-cloudfront-custom-headers-3d134a2c18a2
tldr:
You can't-do only with S3. You need to use CloudFront and Lambda via Lambda@Edge. It's an integration between Lambda and CloudFront. It allows you to run Lambdas within the CloudFront. This allows you to change headers among other things. So if you are ok accessing your S3 via CloudFront then this could be a viable option.
I don't think it is possible with their current API. They cover the major headers you will need for caching and browser interoperability.
I think they are being safe in only allowing x-amz-meta-
prefixed custom headers, possibly to keep from clashing with user selected headers when they update their api in the future.
If you need custom attributes attached to your objects, it should be trivial to parse out the x-amz-meta-
in your client application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With