half-hitch
half-hitch

Reputation: 173

OptionsRequestDenied When Uploading File to S3

When I try to upload a JS file to S3, I get the upload error: OptionsRequestDenied. All the other files, including the JS ones have worked except this one.

The file makes some cross-origin requests using jQuery like this:

function corsRequest(callback){
  $.get("www.example.com", function(data, status){
    callback(data);
  })
}

setInterval(corsRequest, 5000);

I've tried changing the CORS settings to allow all methods:

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

However, OPTIONS is not allowed and returns the error:

Found unsupported HTTP method in CORS config. Unsupported method is OPTIONS

I even created a fresh bucket and it won't upload there either.

I can't find a reference to the error in the AWS docs. Any help would be appreciated.

Upvotes: 13

Views: 8044

Answers (11)

95faf8e76605e973
95faf8e76605e973

Reputation: 14191

I've encountered this issue a couple of times.

Basically, for me the issue was with regards to my internet connection. Our network here is very unstable so sometimes it is fast and sometimes it is very slow and the internet connection can intermittently get disconnected.

So if you encounter this and the other answers for this question did not help - you are probably encountering the same scenario as I am. The simple solution is to connect to the internet from a more reliable source or simply retry the upload if you feel confident that your connection is now stable (e.g., after resetting the router, etc).

FYI I am mostly using Chrome & Opera browsers for work when I encountered this.

Upvotes: 0

Okot Daniel
Okot Daniel

Reputation: 21

i personally have faced the same challenge and i installed a vpn on my browser and i was able to upload the files to my aws s3 buckets.

Upvotes: 0

john
john

Reputation: 1

I had the error in Edge, for a single csv out of 9 files which were from the same source, and switched to Chrome where it uploaded fine.

Upvotes: 0

P4113N
P4113N

Reputation: 1

I was having this issue, didn't have an ad blocker on but did have my VPN running. Turned it off and the upload worked as normal.

Upvotes: 0

Heather Holm
Heather Holm

Reputation: 11

In Chrome Settings under Privacy and Security, I disabled "Send a "Do Not Track" request with your browsing traffic" and it worked.

Upvotes: 0

Shiva
Shiva

Reputation: 2838

None of the above solutions worked for me.
I was able to upload the files successfully while on home internet. Turns out my workplace network/firewall was causing the error.

Upvotes: 0

Sukhi
Sukhi

Reputation: 14185

It's more of a workaround than solution - Safari on Mac has a problem. Chrome worked in my case.

Upvotes: 0

kontrollanten
kontrollanten

Reputation: 2829

It seems that allowing cookies makes it work for me in Brave.

Brave settings

Upvotes: 9

Jo&#227;o Nunes
Jo&#227;o Nunes

Reputation: 3761

Disable "Prevent cross-site tracking" in Privacy tab in safari settings

Upvotes: 3

Simon Carr
Simon Carr

Reputation: 191

Hey just in case anyone runs into this in Safari as well, under Privacy you need to disable "cross-site blocking" to get this to work at least as of October 29th 2018

Upvotes: 19

Mayowa Daniel
Mayowa Daniel

Reputation: 427

Turning off any tracking blocker extension like uBlock Origin fixed it for me.

Upvotes: 9

Related Questions