open-notify / Open-Notify-API

Source code for api.open-notify.org
http://open-notify.org/Open-Notify-API/
Other
351 stars 72 forks source link

CORS header, please? #6

Closed mcepl closed 7 years ago

mcepl commented 9 years ago

Would it be possible to add CORS headers, so that any JavaScript website could access the API? More or less it requires to add Access-Control-Allow-Origin header on all responses with the value of *.

More documentation on:

natronics commented 7 years ago

Fixed!

curl -v http://api.open-notify.org/iss-now/
*   Trying 138.68.39.196...
* Connected to api.open-notify.org (138.68.39.196) port 80 (#0)
> GET /iss-now/ HTTP/1.1
> Host: api.open-notify.org
> User-Agent: curl/7.50.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: nginx/1.6.2
< Date: Sun, 06 Nov 2016 20:44:24 GMT
< Content-Type: application/json
< Content-Length: 112
< Connection: keep-alive
< access-control-allow-origin: *
< 
* Connection #0 to host api.open-notify.org left intact
{"iss_position": {"latitude": "18.6618", "longitude": "84.3757"}, "message": "success", "timestamp": 1478465064}