annotationsatharvard / catcha

Catch-A - Catching Annotation: An annotation backend and API.
http://catcha.readthedocs.io
20 stars 9 forks source link

No CORS header in OPTION response #79

Closed xcompass closed 8 years ago

xcompass commented 8 years ago

Hi there,

We have installed a server following the instruction here: http://catcha.readthedocs.io/en/latest/admin-guide/installation/ using docker: https://hub.docker.com/r/compass/catcha/

The server is up and running. However, when I tried to enable it in edX. I got an error message saying "The annotation server is down". I traced down to the reason that the response of the first OPTION request doesn't include "Access-Control-Allow-Origin" header. So that API query failed.

When I look at the code, it seems enabled by default: https://github.com/annotationsatharvard/catcha/blob/fb7aae05ccc1ffbedbe388fec79c34de3e30aa74/grails-app/conf/Config.groovy#L204

Is there anywhere else I should enable it? Or any advice? Thanks.

PS: I'm using the latest released binary.

jmiranda commented 8 years ago

Sorry, I'm traveling / on vacation this week, so I might not be able to help you too much. But if you followed those instructions to the T, then you're probably using an older version of the Catch API (0.5.4). I can't remember if that version contained the CORS plugin or not. My recommendation would be to download the latest release from the GitHub Releases page (https://github.com/annotationsatharvard/catcha/releases/latest) and let me know if that resolves your issue.

jmiranda commented 8 years ago

Just read your postscript about being on the latest version (double check that you are using 0.5.12). Unfortunately, I probably won't be able to debug this until I get back on Aug 1. In the meantime, I will ask another API user from HarvardX (Luis Duarte) if he has any advice.

lduarte1991 commented 8 years ago

Not sure how much I can help on this one. According to email conversations I had with Justin at the time (a little over a year ago), I was just querying the wrong port and was thus not getting the correct headers returned. I had missed out the fact that I needed to query :8080 instead of :8000. Not sure how relevant it is to this though...

xcompass commented 8 years ago

@jmiranda Thanks for the reply from your vacation. I'm using 0.5.12. @lduarte1991 I'm using port 8080 and I can get a response from the server, it is just no CORS header in the response, so the subsequent API calls are blocked by browser because of the missing CORS.

xcompass commented 8 years ago

BTW: once it's working, I would like to donate the docker file/deployment script to you guys. If it is OK for you.

xcompass commented 8 years ago

I think I figured it out. I deployed the application at ROOT and was using wrong URL. I should use https://my.server/annotator instead of https://my.server/catch/annotator. I got confused because https://my.server/catch/annotator gave me a 304 response. So I though I was hitting the correct URL just missing the authentication piece. I think it should return 404 instead of 304.

jmiranda commented 8 years ago

That's great news. I just got back to the mainland so let me know if you have any other issues. I'll look into the 404 vs 304 when I get a chance.

And thank you, a dockerfile for catch would be incredibly useful.