Readers of my blog know I am a huge fan of Node-RED so now you can learn about it in the upcoming tech talk by IBM developerWorks. I most recently used Node-RED in an Eclipse application where I provide an automatic translation service for a tool called PET.
IBM developerWorks Open Tech Talk Node-RED
Categories: Cloud, Internet of Things
Node-RED is a tool for wiring together the Internet of Things in new and interesting ways, including hardware devices, APIs, and online services. Node-RED makes it easy to wire together real-world events, add in some intelligence, and access simple nodes to integrate them with existing messaging systems and social platforms such as Twitter, MongoDB, and Redis to create apps that can react to the world around them.. Learn more.
The problem is, if CORS is not enabled on the WebSphere Commerce server you will receive the infamous No ‘Access-Control-Allow-Origin’ header is present on the requested resource. And the call fails.
Now WebSphere Commerce can be a little tricky if your server has a web server in front of it. You essentially have to enable it in both places – or at least that is what I had to do. If I only had to do one of these please let me know – I got tired of testing the different tips from the netverse.
I have IHS in front of WebSphere Commerce, so, after hours of playing around with different configurations I came up with these steps:
First configure httpd.conf in the IHS/conf directory and add these lines if you want all domains to be able to access your data:
Header set Access-Control-Allow-Origin"*"
Header set Access-Control-Allow-Methods "GET, PUT, OPTIONS"
Header set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
Remember, you can always override the Access-Control-Origin with a domain or multiple domains to prevent access for everyone.
Next, you have to update the WebSphere Commerce server. You can actually see the Commerce Insights enabling documentation for this (my colleague pointed me to this, thanks J). You will be editing the WC configuration file and the WC Search configuration file.
This means you can now truly “learn once and run everywhere”. The great news is you can start coding now on BlueMix. Check out this article to see how React Native can be developed and deployed on BlueMix. If you are doing a cool project using React or React Native send me a link to your post, I would like to check it out.