artii-api icon indicating copy to clipboard operation
artii-api copied to clipboard

Enable CORS?

Open supersonicclay opened this issue 8 years ago • 4 comments

First off, I love your service! Would it be possible to allow cross origin requests?

When I try and access http://artii.herokuapp.com/make?Hi from a web application, I get the following error:

XMLHttpRequest cannot load http://artii.herokuapp.com/make?Hi. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.

I'm not trying to use your API for production use, just for some web development training and tinkering.

supersonicclay avatar Nov 09 '15 19:11 supersonicclay

Yes, I think you can't make XHR requests against this API, I don't think it would be hard to support cross origin requests, but I won't be able to do it in the near future.

If you need it right now I'd suggest to create a proxy server to consume this API.

You could also add this feature by submitting a PR to speed up the process.

potomak avatar Nov 09 '15 21:11 potomak

Sorry, I don't really have a Ruby environment or know Ruby at all. But here's a jsfiddle that reproduces the issue.

http://jsfiddle.net/oq9zg45k/

supersonicclay avatar Nov 09 '15 22:11 supersonicclay

Yes this could be really usefull

Emaxoso avatar Feb 10 '17 20:02 Emaxoso

When I try and access http://artii.herokuapp.com/make?Hi

better using https://artii.herokuapp.com/make?text=Hi

EDM115 avatar Mar 02 '22 14:03 EDM115