jpillora / grunt-aws

A Grunt interface into the Amazon Node.JS SDK
171 stars 44 forks source link

Handling other standard S3 object metadata #3

Closed justinbelcher closed 10 years ago

justinbelcher commented 10 years ago

I'd like to set x-amz-website-redirect-location in a few instances. The custom metadata option gets close to this, but prepends -meta. Any suggestions?

jpillora commented 10 years ago

Ah that's a bug if its doing that, will take a look soon

On Friday, November 15, 2013, Justin Belcher wrote:

I'd like to set x-amz-website-redirect-location in a few instances. The custom metadata option gets close to this, but prepends -meta. Any suggestions?

— Reply to this email directly or view it on GitHubhttps://github.com/jpillora/grunt-aws/issues/3 .

jpillora commented 10 years ago

See https://github.com/jpillora/grunt-aws#headers-object

justinbelcher commented 10 years ago

@jpillora as far as I can tell, the website redirect header is not being properly set in S3. Here is the task config:

docsStyleRefRedirect: {
  src: 'docs/framework/ios/latest/style-reference.html',
  cwd: '<%= compile_dir %>',
  options: {
    headers: {
      WebsiteRedirectLocation: '/docs/framework/ios/2.0/style-reference',
      ContentType: 'text/html',
      CacheControl: 'no-cache'
    }
  }
}

The file makes it to S3, and the ContentType header is set properly, but there's no WebsiteRedirectLocation.

jpillora commented 10 years ago

I have a feeling I'm using an old version of AWS, will look into this tonight

On Saturday, November 16, 2013, Justin Belcher wrote:

@jpillora https://github.com/jpillora as far as I can tell, the website redirect header is not being properly set in S3. Here is the task config:

docsStyleRefRedirect: { src: 'docs/framework/ios/latest/style-reference.html', cwd: '<%= compile_dir %>', options: { headers: { WebsiteRedirectLocation: '/docs/framework/ios/2.0/style-reference', ContentType: 'text/html', CacheControl: 'no-cache' } } }

The file makes it to S3, and the ContentType header is set properly, but there's no WebsiteRedirectLocation.

— Reply to this email directly or view it on GitHubhttps://github.com/jpillora/grunt-aws/issues/3#issuecomment-28600957 .

jpillora commented 10 years ago

That's strange, it works for me:

    s3: {
      options: {
        accessKeyId: "<%= aws.accessKeyId %>",
        secretAccessKey: "<%= aws.secretAccessKey %>",
        bucket: "jpillora-usa",
        headers: {
          WebsiteRedirectLocation: '/docs/framework/ios/2.0/style-reference'
        }
      },
      build: {
        cwd: "build",
        src: "foo.js"
      }
    }

Now http://s3.amazonaws.com/jpillora-usa/foo.js has:

Accept-Ranges:bytes
Content-Encoding:gzip
Content-Length:34
Content-Type:application/javascript
Date:Sat, 16 Nov 2013 00:54:50 GMT
ETag:"dea704a1a3e3bdfccfeba369302e006c"
Last-Modified:Sat, 16 Nov 2013 00:54:30 GMT
Server:AmazonS3
x-amz-id-2:MarYLlNKo/2AgW+8soS62fZK3ocjLsCcgR7aqxKHyAymiYfLktXBDAIyJHpZnV9E
x-amz-request-id:AF12901620BFC469
x-amz-website-redirect-location:/docs/framework/ios/2.0/style-reference

Did you grab the new version of grunt-aws (0.2.7)?

justinbelcher commented 10 years ago

Ah, yes my package.json skipped the new version. I can confirm this works as expected. Thanks!

jpillora commented 10 years ago

Awesome

On Sat, Nov 16, 2013 at 1:38 PM, Justin Belcher notifications@github.comwrote:

Ah, yes my package.json skipped the new version. I can confirm this works as expected. Thanks!

— Reply to this email directly or view it on GitHubhttps://github.com/jpillora/grunt-aws/issues/3#issuecomment-28618011 .