lobid / lodmill

This repo is replaced by i.a. https://github.com/hbz/lobid-resources/
19 stars 8 forks source link

Enable CORS #786

Closed jbaiter closed 8 years ago

jbaiter commented 8 years ago

This has already been a solved issue in the past (https://github.com/lobid/lodmill/issues/423), but it seems that the Acces-Control-Allow-Origin header has been removed since. Would it be possible to re-enable it? I would like to use the API for some auto-completion forms in a web application I'm developing and I'd hate to proxy it through my server just to get around the CORS restrictions.

acka47 commented 8 years ago

Here's the original (now closed) issue: https://github.com/lobid/lodmill/issues/423

acka47 commented 8 years ago

@jbaiter Could you please specify about which endpoint you are talking? As far as I can see, it works for the endpoints in production: https://lobid.org/resource and http://lobid.org/subject and http://lobid.org/organisation.

It also seems to work for http://beta.lobid.org/organisations. The only one where it doesn't work is the lobid-resources API 2.0 (in beta) with the hbz union catalogue data, e.g. http://lobid.org/resources/HT014681992. Are you already using this endpoint?

jbaiter commented 8 years ago

I'm using the /subject endpoint, here are the headers that I get from my shell with httpie:

GET /subject?q=Proserpina&format=full&type=http://d-nb.info/standards/elementset/gnd%23Person HTTP/1.1
Connection: keep-alive
Host: lobid.org
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: HTTPie/0.9.2

HTTP/1.1 200 OK
Date: Tue, 01 Mar 2016 09:29:52 GMT
Content-Type: application/json; charset=utf-8
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 3416
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive

I also don't see the header on any of the endpoints you linked to :-/

fsteeg commented 8 years ago

423 is about CORS support for the context document, which is required for JSON-LD with linked contexts in the playground. Our current production endpoints never had CORS support, but they support JSONP callbacks.

For your query: http://lobid.org/subject?q=Proserpina&format=full&type=http://d-nb.info/standards/elementset/gnd%23Person&callback=jsonp

See also /subject sample usage at: http://lobid.org/api#auto-suggest-examples

jbaiter commented 8 years ago

Ouch, sorry, I complete skipped over that part! Thanks for the clarification :-)

acka47 commented 8 years ago

i guess we can close this then. Closing.