13
votes

We're enabling our users to upload videos onto our S3 bucket. It's been fitted with the "acceleration" option and using Multi-Part upload from our JS. However, we've noticed something very disturbing: We have thousands of successful uploads from countries where the Internet is fast.

However, virtually all slow connection users (who all happen to be from places the internet isn't famous for speed) fail to upload. Once they do begin to upload they get dozens these errors on their console and the upload gets stuck and fails.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://our-secret-bucket-xxxxxx.s3-accelerate.amazonaws.com/tyoeu/Abbey%…BAYmLRf4.YqtrWLwkD9uc5wGp0.rpyIV6xqDHxHqNaEsaxQTMAHs3g8DXdL3. (Reason: CORS request did not succeed).

The CORS setup for this bucket is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>PUT</AllowedMethod>
    <AllowedMethod>POST</AllowedMethod>
    <AllowedMethod>GET</AllowedMethod>
    <AllowedMethod>HEAD</AllowedMethod>
    <MaxAgeSeconds>43200</MaxAgeSeconds>
    <ExposeHeader>ETag</ExposeHeader>
    <AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>

We help the upload failed users manually by asking them to upload to dropbox and share a link with us -- but this is just another proof something is wrong -- if they can upload to Dropbox with their slow connections, why can't they upload to AWS/S3? This has been gnawing at our souls for quite some time now and we can't understand what's wrong.

Surely we're not the only company on planet Earth allowing folks from around the world to upload large files. Why are we failing with slow connection users?

2
I recommend that you open a ticket with AWS if you haven't already. - Greg
@Greg thanks. will try that too. - JasonGenX
@JasonGenX, did you try to emulate behaviour on chrome by setting poor network profile? are you able to reproduce the issue that way? And if you do what do you see in the network tab? - Tarun Lalwani
Try not to use chrome. IE 11 or Edge or Firefox. - Jin Thakur
Did you try to enable logs for your bucket? If you see connections and data flowing to your bucket from these places, then you may discard CORS problems. I have read sometimes browsers confuses issues with CORS matters. - Perimosh

2 Answers

3
votes

Seems like this may be a request timeout issue, have you tried changing your aws.config.httpOptions.timeout? This defaults to two minutes but you can completely remove the timeout by setting it to zero. More info on this can be found here.

Edited to fix broken link.

1
votes

Please try following steps

1.Create a non accelerated version of s3 bucket and try with those users. If it works then create a program to copy over. I am not sure why Cors is there.

2.Using the Amazon S3 Transfer Acceleration Speed Comparison Tool

  1. try dual stack Transfer data to and from the acceleration-enabled bucket by using one of the following s3-accelerate endpoint domain names:

bucketname.s3-accelerate.amazonaws.com – to access an acceleration-enabled bucket.

bucketname.s3-accelerate.dualstack.amazonaws.com – to access an acceleration-enabled bucket over IPv6. Amazon S3 dual-stack endpoints support requests to S3 buckets over IPv6 and IPv4. The Transfer Acceleration dual-stack endpoint only uses the virtual hosted-style type of endpoint name. For more information, see Getting Started Making Requests over IPv6 and Using Amazon S3 Dual-Stack Endpoints. You can use the Amazon S3 Transfer Acceleration Speed Comparison tool to compare accelerated and non-accelerated upload speeds across Amazon S3 regions. The Speed Comparison tool uses multipart uploads to transfer a file from your browser to various Amazon S3 regions with and without using Transfer Acceleration.

It is copied from this article https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html

http://s3-accelerate-speedtest.s3-accelerate.amazonaws.com/en/accelerate-speed-comparsion.html