Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OptionsRequestDenied When Uploading File to S3

Tags:

amazon-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.

like image 745
half-hitch Avatar asked Jul 17 '18 15:07

half-hitch


People also ask

Why is my s3 bucket Access Denied?

The "403 Access Denied" error can occur due to the following reasons: Your AWS Identity and Access Management (IAM) user or role doesn't have permissions for both s3:GetBucketPolicy and s3:PutBucketPolicy. The bucket policy denies your IAM identity permission for s3:GetBucketPolicy and s3:PutBucketPolicy.

Why am I getting an access denied error message when I upload files to my Amazon s3 bucket that has aws kms default encryption?

This error message indicates that your IAM user or role needs permission for the kms:GenerateDataKey and kms:Decrypt actions. Follow these steps to add permissions for kms:GenerateDataKey and kms:Decrypt: 1. Open the IAM console.


1 Answers

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

like image 75
Mayowa Daniel Avatar answered Sep 23 '22 20:09

Mayowa Daniel