how to call rest api by Javascript by Cross-Origin Resource Sharing (CORS)

301 views
Skip to first unread message

Ajax Zhang

unread,
Mar 6, 2014, 5:57:06 AM3/6/14
to rundeck...@googlegroups.com
I'm using jquery ajax , to call the rest api of Rundeck

like 

$.ajax(
{
url:"{rundeck_url}/api/1/job/5?authtoken=D4CUK8DD5DP4sovSR7p9UUnd5DnvU3do"
}
);

but get error from brower for doing an XMLHttpRequest to a different domain 

XMLHttpRequest cannot load {rundeck_url}/api/1/job/5?authtoken=D4CUK8DD5DP4sovSR7p9UUnd5DnvU3do. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '{site_url}' is therefore not allowed access. 

what I need to do is something different when you want to do a cross-domain request. A tutorial about how to achieve that is Using CORS.

Is there any config to set up the  header for Cross-Origin ?

Thanks

Greg Schueler

unread,
Mar 6, 2014, 12:18:40 PM3/6/14
to Ajax Zhang, rundeck...@googlegroups.com
Hi,

please file a feature request to add a config option to add the CORS support to rundeck, thanks.

--
Greg Schueler
--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages