How to enable Cors in Node-Red ?

1,271 views
Skip to first unread message

Zyxmn Daley Jes

unread,
Jul 14, 2015, 11:36:02 AM7/14/15
to node...@googlegroups.com
Hello Everyone,

I am a node.js and node-red newbie and hope you guys could help me out. 

Basically I would like to enable CORS in Node-RED for an application I created that runs on IBM Bluemix node.js runtime. I came across a similar post here.

There is a bluemix-setting.js file in IBM Bluemix that seems to take the cors settings. The setting I have right now to enable cors is:

<code>
httpNodeCors: { 
origin: "*", 
methods: ['GET','PUT','POST','DELETE'] },
</code>

But I still seem to get a 403 forbidden nginx error  when I try to get data from the bluemix application with the above settings . I am not sure if my httpNodeCors function setting is right. Could anyone confirm if my httpNodeCors setting mentioned about is correct?


Bob Balfe

unread,
Oct 29, 2015, 10:58:03 AM10/29/15
to Node-RED
I had a similar problem and eventually found that in the Cloudant admin UI under profile you can switch CORS on. You can read about the process in my blog post here. http://bit.ly/1KGcssp

The syntax that was generated in the bluemix-settings.js is this:

httpNodeCors: { origin: "*", methods: ['GET','PUT','POST','DELETE'] },


Nicholas O'Leary

unread,
Oct 29, 2015, 11:04:30 AM10/29/15
to Node-RED Mailing LIst
Hi Bob,

I read your post with interest. I couldn't work out the relevance of touching anything to do with Cloudant. Enabling CORS in the Cloudant admin view just means you can access that cloudant instances from a different domain - it has no active role in whether you can access a node-red flow across domains.

The httpNodeCors setting in bluemix-settings.js is the only relevant thing.

Nick


--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages