mkalam-alami / ludumdare-feedback-friends

A (defunct) incentive to comment on games, initially made for LD36
http://feedback.ld.intricati.com
MIT License
12 stars 5 forks source link

Allow cross-origin access to API #21

Closed williame closed 8 years ago

williame commented 8 years ago

I am making the LD map use your API, which will ensure that users get a consistent view of their comment status on both UIs.

However, when I try and fetch from api.php I get a COR error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://feedback.ld.intricati.com/api.php?action=eventsummary&event=undefined. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

The preferred solution is to emit the header.

An alternative solution is to support JSONP, e.g. via an optional callback parameter.

thx

williame commented 8 years ago

(I think I can solve this by running my own caching server)

mkalam-alami commented 8 years ago

We could certainly open things up with CORS headers or JSONP support, no problem for me.

Now I've been thinking, if we're considering the long term, your map will probably outlive the FF site, so it might not be viable for LD37+ to rely on our API. It's your call though, I don't know how hard it would be to change the code one way or another.

mkalam-alami commented 8 years ago

I just added a 'Access-Control-Allow-Origin: *' header. I'm not a CORS expert but I assume it will suffice? The live website is up to date if you want to try it.

williame commented 8 years ago

Works a charm! Thousand thanks :)