问题
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.
回答1:
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
回答2:
It seems that allowing cookies makes it work for me in Brave.
回答3:
Turning off any tracking blocker extension like uBlock Origin fixed it for me.
回答4:
Disable "Prevent cross-site tracking" in Privacy tab in safari settings
回答5:
It's more of a workaround than solution - Safari on Mac has a problem. Chrome worked in my case.
回答6:
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.
回答7:
In Chrome Settings under Privacy and Security, I disabled "Send a "Do Not Track" request with your browsing traffic" and it worked.
回答8:
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.
来源:https://stackoverflow.com/questions/51385091/optionsrequestdenied-when-uploading-file-to-s3