Skip to content
Srinivasan Parthasarathy edited this page Dec 2, 2016 · 6 revisions

There are situations when READ attempts to access a REST API but the access fails since the REST service is not configured for Cross Origin Resource Sharing (CORS). Below are two possible workarounds in these situations.

IBM Streams data based on the HTTPTupleView Operator

Ensure that you are using the latest version of the streams.inet toolkit. You can set the "Access-Control-Allow-Origin: '*'" header for HTTPTupleView to enable CORS data access for READ. This SPL example illustrates the use of CORS header within HTTPTupleView.

Using the CORS Proxy bundled with READ

  1. Install NodeJS
  2. Navigate to the streamsx.visualization/READ.develop folder in a terminal. Get the public IP address for your machine; say 8.74.12.82. Then, type the command CORSPROXY_HOST=8.74.12.82 CORSPROXY_PORT=3003 ./node_modules/corsproxy/bin/corsproxy
  3. The above command should start the CORS proxy at port 3003. While creating a READ data set with another URL, say http://my.domain.com:2912/path/to/resource, use the following proxied URL instead: http://8.74.12.32:3003/my.domain.com:2912/path/to/resource
  4. Refer to the CORS Proxy project page for further details such as increasing the payload limits for CORS requests (default = 1MB).
Clone this wiki locally