CORS not working Openhab 1.8.0


I’m trying a jquery/atmosphere based ui based on apache.
When I try to get data from openhab I get these errors:
XMLHttpRequest cannot load http://raspberrypi:8080/rest/items/SW_PC/state. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://raspberrypi' is therefore not allowed access. The response had HTTP status code 401.
What can I do?


I am having the same issue, anyone have any information? Using 1.8 here as well.

I’m having the same issue, using 1.8.1

I ended up proxing the requests using curl from the web server trying to hit the rest endpoints. Seems to work, haven’t used it extensively yet.

It works without web browser. The problem is that the web browser send OPTIONS request and that the openhab web server ask authentification if you configure user and password in openhab. But with standard CORS no authentification is required for OPTIONS request.

Using angular.js I always got the CORS error when sending with or without credentials. Course I want the credentials to be used. With the proxy i modified the code to send credentials in the curl header.