将文件上传到S3时的OptionsRequestDenied [英] OptionsRequestDenied When Uploading File to S3
问题描述
当我尝试将JS文件上传到S3时,出现上传错误:OptionsRequestDenied.除此文件外,其他所有文件(包括JS文件)都可以使用.
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.
该文件使用jQuery发出一些跨域请求,如下所示:
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);
我尝试更改CORS设置以允许所有方法:
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>
但是,不允许OPTIONS
并返回错误:
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.
我在AWS文档中找不到对该错误的引用.任何帮助将不胜感激.
I can't find a reference to the error in the AWS docs. Any help would be appreciated.
推荐答案
嘿,以防万一也有人在Safari中遇到此问题,在隐私"下,您需要禁用跨站点阻止"功能,才能使其至少在于2018年10月29日
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
这篇关于将文件上传到S3时的OptionsRequestDenied的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!