S3 Not responding to OPTIONS request when using presigned URL from the browser

Issue #20 resolved
aaron_stillwell created an issue

I'm attempting to use a pre-signed URL from within the browser to upload to my localstack S3 service. Generating the URL itself is trivial, however when attempting to POST to the resulting url (e.g http://localstack:4572/ps.local/test?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD...), the browser makes an OPTIONS preflight request, to which localstack does not respond.

It appears as if there is no way around this even with flexible CORS rules (see below). It's not therefore possible to directly upload files from the browser to localstack S3 using presigned URL's.

            $s3->putBucketCors([
                'Bucket' => 'myBucket',
                'CORSConfiguration' => [
                    'CORSRules' => [
                        [
                            'AllowedOrigins' => ['*'],
                            'AllowedMethods' => ['POST', 'GET', 'PUT'],
                            'MaxAgeSeconds' => 3000,
                            'AllowedHeaders' => ['*']
                        ]
                    ]
                ]
            ]);

If someone can advise on whether or not I've overlooked something I'll be happy to investigate further and follow up with a PR.

Moved from original github issue: https://github.com/atlassian/localstack/issues/99

Confirmed as bug, will investigate further.

Comments (7)

  1. Waldemar Hummer Account Deactivated

    @aaron_stillwell Thanks for reporting. Did you have a chance to investigate this, and if so would you be able to prepare a pull request? (Based on our discussion on Github regarding a possible fix). Thanks

  2. aaron_stillwell reporter

    @w_hummer should be able to follow up with a PR when the time allows (tomorrow / monday)

  3. aaron_stillwell reporter

    @w_hummer really sorry I haven't had the time to properly dig into this. The bitbucket readme suggests this project is now based on github but I'm still getting issue notifications from bitbucket, could you please clarify which is correct?

    I'll have a look at the CORS rules today and try and find to contribute something!

  4. Log in to comment