Issue #043 [WontFix/closed] - enable CORS support or JSONP support for REST API

Posted by m.devita

What steps will reproduce the problem?

  1. create an ajax request to the http rest api, using another server even locally with different port
  2. initiate the requset, and you will get CORS error 3. ...

WebIOPi version used? =>

Python version used? =>

Distro used? (WebIOPi has only been tested on Raspbian Wheezy) =>

Raspberry Pi board revision? (1 or 2) => 1

For Javascript side bugs, Browser? =>

Please provide any additional information below.

Need to enable CORS headers on python server side, or allow jsonp return of data. I am attempting to communicate to the raspberry pi's GPIO via REST but since my nodeJs http server is running on port 80 and the webiopi is running on port 8000 it causes a CORS issue. JSONP wont work as data is transmitted as text/plain and callback is dropped.

Comment 1

Posted by trouch

refused for security issue. you should proxy requests from your front server to webiopi instead.

Comment 2

Posted by m.devita

Can you provide any documentation on how to do this?

Comment 4

Posted by trouch

I don't know how to do it using nodejs. sorry. for apache, you have to use proxypass directive.

Comment 5

Posted by trouch

Issue 50 has been merged into this issue.