REST API Cross Side Scripting

Hey,

I'm trying to implement a customized Website to upload/list/preview Data from Orthanc. The REST API ist very nice as long as the Orthanc Server is the same as the webserver where the website is hosted.

Is there any possibility to query data via REST API without to violate the Same-Origin-Policy? I tried to use JSONP with AJAX but Orthanc didn't seem to support callback functions.

Is there any other solution for this problem or am I completely off the track?

Best
Tobi

Hello,

The most direct way to avoid the Same-Origin-Policy restrictions would be to “mount” the REST API of Orthanc in some path of your Web server. This is called reverse proxying. Instructions for Apache are given in our FAQ:
https://code.google.com/p/orthanc/wiki/FAQ#How_can_I_run_Orthanc_behind_Apache?

HTH,
Sébastien-

Hey Sébastien,

funny, I came across this solution almost at the same moment you posted this answer.
Thank you - this solved my problem!

Best, Tobi

`
For anyone uses nginx for webserver, modify these lines in your nginx config file:

`

server{
listen 80 default_server;

location /orthanc/ {
proxy_pass http://localhost:8042;
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
rewrite /orthanc(.*) $1 break;
}

}

`

`
在 2014年4月25日星期五UTC+8下午4时35分44秒,tobi…@gmail.com写道:

Dear Qaler,

Thanks for this information! I have just included it in the FAQ:
http://goo.gl/Y7yh25

Cheers,
Sébastien-