We're Hiring!

Cross Domain Requests Support?

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Cross Domain Requests Support?

Postby jwarren » Tue Feb 21, 2017 1:30 pm

Hi

We have a federated system working but I'm currently using frames for this and not the javascript method that we use for internal requests. This is a pain. So I'd like to start using CORS.

Was just after documentation or tips on using OMERO with cross origin/domain javascript requests both on the client side and the server side?

Does the javascript api support adding cors headers?
e.g. GET /cors HTTP/1.1
Origin: http://api.bob.com
Host: api.alice.com
Accept-Language: en-US
Connection: keep-alive
User-Agent: Mozilla/5.0...

I'm assuming server side header responses from the webgateway have to be set up the same way or similarly to any django web app?

Any pointers appreciated!

Thanks

Jonathan.
jwarren
 
Posts: 102
Joined: Wed Jul 09, 2014 1:35 pm

Re: Cross Domain Requests Support?

Postby atarkowska » Wed Feb 22, 2017 10:09 am

Hi,

Some of OMERO.web views are decorated with JSONP so you don't need to worry about CORS, see the example doc of how to embed image viewer into your website https://www.openmicroscopy.org/site/sup ... wPort.html and JSfiddle https://jsfiddle.net/aleksandratarkowska/25hyc85x/. Although that is only limited to the following read-only urls http://downloads.openmicroscopy.org/ome ... teway.urls

If you are planning to list the data like it is exposed in OMERO.webclient you have to enable CORS Headers, for example like https://github.com/crs4/ome_seadragon/wiki/Enable-Django-CORS-(Cross-Origin-Resource-Sharing)-Headers-configuration.

Hope that helps

Ola
atarkowska
 
Posts: 327
Joined: Mon May 18, 2009 12:44 pm


Return to Developer Discussion

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron