-
Notifications
You must be signed in to change notification settings - Fork 4
3. CORS Issues
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.
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.
- Install NodeJS
- Navigate to the
streamsx.visualization/READ.developfolder in a terminal. Get the public IP address for your machine; say 8.74.12.82. Then, type the commandCORSPROXY_HOST=8.74.12.82 CORSPROXY_PORT=3003 ./node_modules/corsproxy/bin/corsproxy - 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
- Refer to the CORS Proxy project page for further details such as increasing the payload limits for CORS requests (default = 1MB).