Hi!
I am constantly getting error related to CORS headers:
XMLHttpRequest cannot load https://www.kaltura.com/api_v3/?(...). Request header field Content-Range is not allowed by Access-Control-Allow-Headers in preflight response.
Here is my preflight OPTIONS request:
Accept:*/*
Accept-Encoding:gzip, deflate, sdch, br
Accept-Language:pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4
Access-Control-Request-Headers:content-disposition, content-range
Access-Control-Request-Method:POST
Connection:keep-alive
Host:www.kaltura.com
Origin:http://localhost:50053
Referer:http://localhost:50053/Resources/Create
User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
and response:
Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept, Range, Cache-Control
Access-Control-Allow-Methods:POST, GET, HEAD, OPTIONS
Access-Control-Allow-Origin:*
Access-Control-Expose-Headers:Server, Content-Length, Content-Range, Date
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:20
Content-Type:text/html
Date:Wed, 15 Mar 2017 13:33:21 GMT
Keep-Alive:timeout=5, max=100
Server:Apache
Vary:Accept-Encoding
X-Me:ny-front-api39
There is Content-Range header
in Access-Control-Expose-Headers
so why my browser stops me from POSTing next XHR's?
I am running this simple js code:
function InjectKalturaFileUploadNEW() {
$('input[name="fileData"]').fileupload({
apiURL: 'https://www.kaltura.com/api_v3/',
url: 'https://www.kaltura.com/api_v3/?service=uploadToken&action=upload&format=1',
ks: kalturaSession,
singleFileUploads: true,
dataType: 'json',
autoUpload: true,
maxChunkSize: 400000,
submit: function (e, data) {
console.log('submit fired')
},
done: function (e, data) {
console.log('done fired')
},
}).on('fileuploaddone', function (e, data) {
console.log('fileuploaddone fired.')
}).on('fileuploadchunkdone', function (e, data) {
console.log('chunkdone fired.')
});
}
Thanks!