Search code examples
htmlcross-domainplupload

Access-Control-Allow-Origin / Plupload HTML5 / Cross-Domain / DMcloud


I'm implementing a video website with Dailymotion Cloud and plupload (HTML5 runtime).

The workflow is :

  1. Retrieve upload URL via dmcloud API

  2. POST file to this URL

  3. Retrieve the JSON data in response in order to display the video

I'm issuing the following on the upload : xmlhttprequest cannot load origin http://localhost:3000 is not allowed by access-control-allow-origin

My issue is that the upload fails with some upload URLs, in a non-deterministic way. When an upload URL works, it works as many times as I want, and when an upload URL doesn't, it never works.

The Dmcloud server sends the Access-Control-Allow-Origin: *. Each request is done in two times : first an OPTION request is sent to ensure that the URL is accepting origin. And then a POST request is done.

OPTION requests ever successed, with good headers, the issue is coming at the end of the POST request...

Do you think that it is a Dmcloud server issue ? A chrome HTML5 issue ? A plupload issue ?

Some network screenshots :

Success: OPTIONS request Success: OPTIONS request

Success: POST request Success: POST request

Fail: OPTIONS request Fail: OPTIONS request

Fail: POST request Fail: POST request


Solution

  • So this was a server-side issue : Access-Control-Allow-Origin header was not sent on upload-02.dmcloud.net.

    The awesome guys of the Dmcloud support team solved this very quickly.

    Thanks to @monsur, who helps me identifying the issue.