AWS S3 large file reverse proxying with golang's http.ResponseWriter
<p>I have a request handler named <code>Download</code> which I want to access a large file from Amazon S3 and push it to the user's browser. My goals are:</p>

<ul>
<li>To record some request information before granting the user access to the file</li>
<li>To not buffer the file into memory too much. Files may become too large.</li>
</ul>

<p>Here is what I've explored so far:</p>

<pre><code>func Download(w http.ResponseWriter, r *http.Request) {

    sess := session.New(&amp;aws.Config{
        Region:             aws.String("eu-west-1"),
        Endpoint:           aws.String("s3-eu-west-1.amazonaws.com"),
        S3ForcePathStyle:   aws.Bool(true),
        Credentials:        cred,
    })

    downloader := s3manager.NewDownloader(sess)
    // I can't write directly into the ResponseWriter. It doesn't implement WriteAt. 
    // Besides, it doesn't seem like the right thing to do.
    _, err := downloader.Download(w, &amp;s3.GetObjectInput{
        Bucket: aws.String(BUCKET),
        Key: aws.String(filename),
    })
    if err != nil {
        log.Error(4, err.Error())
        return
    }

}
</code></pre>

<p>I'm wondering if there isn't a better approach (given the goals I'm trying to achieve).</p>

<p>Any suggestions are welcome. Thank you in advance :-)</p>