Hi there,
I've been using the SDK quite happily for my plugin grunt-aws-s3 which handles upload/download/delete/copy flow for S3 through Grunt.
One of the user recently reported that he wasn't able to set custom headers (without the x-amz-meta prefix) through the plugin (link to discussion and example: https://github.com/MathieuLoutre/grunt-aws-s3/issues/75). I had a look at the docs and couldn't find anything but he seems to be able to do it through direct upload fro the browser (here: https://aws.amazon.com/articles/1434).
Any plans to support that in the SDK soon?
Hey @MathieuLoutre, great question.
It's possible to set custom headers in the SDK by hooking into the event system and modifying the request object directly:
s3.putObject(params).
on('build', function(req) { req.httpRequest.headers['Custom-Header'] = 'value'; }).
send(function(err, data) { ... });
This example is also found in our API documentation. You could expose this in your plugin if you wanted.
Hope that helps!
Ooooh, that's nice. Will give it a try. Must say that I only searched the S3 documentation and didn't think to look in Request. Thanks! Will report how I get on.
@MathieuLoutre I'm marking this as closed since there hasn't been any recent activity on it. Feel free to reopen this issue or open another if you have other questions.
@lsegal Hi there. I finally got around to try this properly and your example (and the docs') isn't working for me with the latest SDK. I can see that it goes through and the header is properly sent with the request but when the file is requested after upload the custom header doesn't show. Am I missing something?
@MathieuLoutre are you uploading to s3 like this? what is the issue you're experiencing?

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.
Most helpful comment
Hey @MathieuLoutre, great question.
It's possible to set custom headers in the SDK by hooking into the event system and modifying the request object directly:
This example is also found in our API documentation. You could expose this in your plugin if you wanted.
Hope that helps!