Azure CORS配置 [英] Azure CORS Configuration
问题描述
我正在使用azure.jquery.fineuplaoder-4.4.0源,并且在尝试上传时遇到这些错误:
I am using the azure.jquery.fineuplaoder-4.4.0 source and am getting these errors when I try to upload:
OPTIONS http://gfbc.blob.core.windows.net/beta 403 (CORS not enabled or no matching rule found for this request.)
XMLHttpRequest cannot load http://gfbc.blob.core.windows.net/beta. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://dev.gfbclife.org' is therefore not allowed access.
我正在使用提供的默认html模板,并像这样调用FineUploader:
I am using the default html template that is provided and calling FineUploader like this:
<script>
$(document).ready(function () {
$("#fine-uploader").fineUploader({
request: {
endpoint: 'http://gfbc.blob.core.windows.net/beta'
},
signature: {
endpoint: '/Signature'
},
retry: {
enableAuto: true
},
deleteFile: {
enabled: true
}
});
});
</script>
我将CORS规则定义为:
I have defined my CORS rule as:
Allowed Origin: http://dev.gfbclife.org
Allowed Methods: Get, head, Post, Put, Delete, trace, Options
Allowed Headers: *
Exposed Headers: *
Max Age: 432000
更新:我已经更正了CORS规则,并且不再遇到以前的错误.我现在收到这些错误:
UPDATE: I have corrected the CORS rule and no longer get the previous errors. I am now getting these errors:
POST http://gfbc.blob.core.windows.net/beta 405 (The resource doesn't support specified Http Verb.)
[Fine Uploader 4.4.0] Error when attempting to parse xhr response text (Unexpected token <)
POST的响应是:
<?xml version="1.0" encoding="utf-8"?><Error><Code>UnsupportedHttpVerb</Code>
<Message>The resource doesn't support specified Http Verb.
RequestId:f24c6afb-6e42-42da-aafb-3151422562cc
Time:2014-05-21T02:26:50.2758734Z</Message></Error>
推荐答案
如错误消息所示,您的CORS规则不正确.您允许的来源必须包括您为request.endpoint
选项提供的URL的域.
As the error message indicates, your CORS rules are incorrect. Your allowed origins must include the domain of the URL you provided for the request.endpoint
option.
这篇关于Azure CORS配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!