Question: Galaxy API - Cross-Origin Request Blocked
2
gravatar for clausbo
4.2 years ago by
clausbo110
Norway
clausbo110 wrote:

I have tried using getJSON and ajax with credentials to make API calls such as "https://usegalaxy.org/api/histories" (with my key parameter of course), but I get: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://usegalaxy.org/api/histories?key=xxx. This can be fixed by moving the resource to the same domain or enabling CORS."

Is there a solution to this to allow cross-origin requests to the Galaxy system, or failing that can I get some pointers on how I can enable CORS for a local instance?

ios android api mobile app • 1.9k views
ADD COMMENTlink modified 4.2 years ago by Martin Čech ♦♦ 4.9k • written 4.2 years ago by clausbo110

Thank you, that is useful.

I am designing an app (Android, iPhone - maybe Windows Phone) to make it possible to connect to a Galaxy instance for some basic interaction over the API. In the first instance I just want to be able to easily retrieve and view histories on a touch device, such as a smartphone, to allow the user to view jobs that are running or have completed.

I am able able to retrieve the JSON data using a Qt and C++, but using jQuery doesn't work due to the cross-origin issue. As I'm not familiar with the Galaxy sourcebase I wanted to know how easy this would be to enable, and your answer at least gives me something to investigate.

ADD REPLYlink modified 4.2 years ago • written 4.2 years ago by clausbo110
1

Do you know: http://usegalaxy.org/mobile ? Do you mind to contribute to this and get in touch with the developers?

ADD REPLYlink written 4.2 years ago by Bjoern Gruening5.1k

Thanks for pointing that out. I would certainly be interested in taking a look to see if I can contribute, but where do I find the devs or project page?

ADD REPLYlink written 4.2 years ago by clausbo110

This is part of the main Galaxy distribution, you need to get in contact with the Galaxy developers :)

ADD REPLYlink written 4.2 years ago by Bjoern Gruening5.1k
3
gravatar for Martin Čech
4.2 years ago by
Martin Čech ♦♦ 4.9k
United States
Martin Čech ♦♦ 4.9k wrote:

Hi clausbo,

same-origin-policy applies to the web browser world. If you want to build a phone app that won't trouble you.

For guidance please see Galaxy Android and iOS applications that were made earlier this year for use with Galaxy sample tracking system (which is just extended Galaxy):

Feel free to fork the repos and play around with the code. Let me know if you need anything.

This particular class - SpecimenResource.java - (and the surroundings) might be of special interest to you:

https://bitbucket.org/galaxyproject/sample-tracker-android/src/18a3d9c98f5c76a2cb35ecf236e659b188886988/app/src/main/java/org/galaxyproject/sampletracker/net/galaxy/resource/SpecimenResource.java?at=master

If you have any other questions or comments, feel free to contact us via Biostar or any other means.

Martin, Galaxy Team

 

ADD COMMENTlink written 4.2 years ago by Martin Čech ♦♦ 4.9k
2
gravatar for jmchilton
4.2 years ago by
jmchilton1.1k
United States
jmchilton1.1k wrote:

If you want to control the allow origin access policy for a local instance I would start by perhaps directly modifying the headers in the Response class in lib/galaxy/web/framework/base.py. If I were to guess - I think you can probably set the 'Access-Control-Allow-Origin' header to '*' in there. This wouldn't affect usegalaxy.org obviously but I could probably help you hack on a local instance.

Little fuzzy about what you are trying to do exactly - more details might help - but hope this helps a little.

ADD COMMENTlink written 4.2 years ago by jmchilton1.1k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 169 users visited in the last hour