REST api CORS error

Hi,

i have a html and calling the REST api in a local network via ajax javascript, but i always get a CORS error in the browser and cant get rid of that…
the webservice is running on 8081…
can somebody help with how to get access to the REST api json objects via javascript?

I subscribing to this thread, because I would like to understand this as well. As far as I know, there is no CORS setting, and so they only workaround is standing up an HTTP proxy.

Which version of Deadline are you running? The Javascript example we’ve got here - Deadline REST API example calls out needing Deadline 7.0 or later due to CORS issues.

If you test with that example, how does it behave? You’ll have to update the server name, port number, and job id to match your setup first.

I’m on 10.3.1, but this is what I did with nginx to get around the CORS issues. Obviously, this breaks the security the CORS policy on the API is trying to achieve.

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;
        location / {
        }
        location /api {
          proxy_pass http://127.0.0.1:8081;
          add_header Access-Control-Allow-Origin *;
        }
    }

i am on 10.3.1.3 and xampp…

testing the requeue example gives me the “Access-Control-Allow-Origin” missing error and this in the browser console:

Blarg! Died! [RequeueJob.html:28:25](http://localhost/deadline/RequeueJob.html)
onerror http://localhost/deadline/RequeueJob.html:28
<empty string> [RequeueJob.html:29:13](http://localhost/deadline/RequeueJob.html)
onerror http://localhost/deadline/RequeueJob.html:29
<empty string> [RequeueJob.html:30:25](http://localhost/deadline/RequeueJob.html)
onerror http://localhost/deadline/RequeueJob.html:30

What kind of results do you get running that script directly instead of through xampp?

That “Blarg! Died!” may mean it’s failed to hit the database, so the issue may not be from your web browser to the web service, but from the web service to the database.