Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fix CORS on s3 #92

Closed
wants to merge 3 commits into from

2 participants

@dstrek

Currently putBucketCors fails because xml builder throws a TypeError and getBucketCors fails because cors isn't included in the signers subResources.

This patch addresses these issues.

@lsegal

Can you fix the whitespace on this (make sure to remove tabs)? Thanks!

@lsegal

I'm curious why this behaviour is necessary. If we are not finding the rules, that seems like a bigger issue and we shouldn't mask it like this.

dstrek properly fix the s3 CORS api
added AllowedHeaders
fixed the api service instead of monkey patching the xml builder
17f9249
@dstrek

Ok I have fixed it, the s3 API definition was incorrect so that's why xml was failing to build, removed the monkey patch.

I also added AllowedHeaders to CORS as defined in the spec.

@lsegal
Owner

Thanks, this makes much more sense. I'll work on some integration tests and merge this if everything looks good.

@dstrek

yeah that needs a test, as it was passing tests with the wrong xml just then :(

@dstrek

Is there something I can do to help push this along?

@lsegal
Owner

I merged this via eb3b8ea and then added some tests and fixed a missing output change to getBucketCors in the above commit. Sorry about taking so long for this, had to find some time to write tests.

Thank you for the contribution!

@lsegal lsegal closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 3, 2013
  1. fix CORS on s3

    dstrek authored
Commits on Apr 4, 2013
  1. properly fix the s3 CORS api

    dstrek authored
    added AllowedHeaders
    fixed the api service instead of monkey patching the xml builder
This page is out of date. Refresh to see the latest.
Showing with 25 additions and 3 deletions.
  1. +24 −3 lib/services/api/s3-2006-03-01.js
  2. +1 −0  lib/signers/s3.js
View
27 lib/services/api/s3-2006-03-01.js
@@ -2102,20 +2102,41 @@ module.exports = {
members: {
type: 'structure',
members: {
+ AllowedHeaders: {
+ type: 'list',
+ flattened: true,
+ name: 'AllowedHeader',
+ members: {
+ AllowedHeader: {
+ }
+ }
+ },
AllowedMethods: {
type: 'list',
flattened: true,
- name: 'AllowedMethod'
+ name: 'AllowedMethod',
+ members: {
+ AllowedMethod: {
+ }
+ }
},
AllowedOrigins: {
type: 'list',
flattened: true,
- name: 'AllowedOrigin'
+ name: 'AllowedOrigin',
+ members: {
+ AllowedOrigin: {
+ }
+ }
},
ExposeHeaders: {
type: 'list',
flattened: true,
- name: 'ExposeHeader'
+ name: 'ExposeHeader',
+ members: {
+ ExposeHeader: {
+ }
+ }
},
MaxAgeSeconds: {
type: 'integer'
View
1  lib/signers/s3.js
@@ -26,6 +26,7 @@ AWS.Signers.S3 = inherit(AWS.Signers.RequestSigner, {
*/
subResources: {
'acl': 1,
+ 'cors': 1,
'lifecycle': 1,
'delete': 1,
'location': 1,
Something went wrong with that request. Please try again.