Http request from a local node-red machine

How can one allow the cloud hosted Node-RED web server to be accessible through http in in a local Node-RED machine?

Hi @ALOKA1432 - To make the request you would use an HTTP Request node - not the HTTP In node. The HTTP In node can be used to create a flow that is triggered by an HTTP request - there are lots of examples in the cookbook - https://cookbook.nodered.org/http/

i got you. i have my Node-RED web server running on a VPS. the problem now is how can i enable access of the data arriving at my cloud server URL to my local node-red using http request? i am unable to access the same data using http request from my local pc.

Just to be clear, you want your local node-red to make an http request to get data from your cloud server?

If that is the case, then you need to create an HTTP-In flow on your cloud-instance of node-red and use an HTTP Request node in your local node-red to send the request.

If your VPS is blocking access, then you need to open up that access. How you do that will depend entirely on your vps - that isn't something we can advise on.

Thanks knolleary for creating such an amazing tool for development of IoT based application specifically.The developer community owe you a lot. from your reply, i understand that the http request is not allowed from my the VPS. is there anything to do with the httpcors inside the settings.js?

Can you point any other browser at your VPS and get the data you want ? Or is that blocked also ?

actually the request i have made from chrome and explorer both using node-red. in both the cases, the request is denied.

@ALOKA1432 how do you access the Node-RED editor then?

yes i do. i can access the Node-RED editor in my VPS using the host name.
The error i am getting is socket hang up when i make an http request from my local Node-RED.

So... to summarise, you can access the editor from your browser, but you cannot access an HTTP-In flow in the same browser?

The Node-RED editor is accessed via HTTP. The very same HTTP server hosts the flows. So there is little difference between accessing the editor and accessing an HTTP-In triggered flow.

Can you share your HTTP-In flow with us?

Yes, you are right. But, why there is a socket hang up error?

No idea. Does your flow end with an HTTP Response node? If not, the request won't get replied to and left to timeout.

It is of course possible your VPS host doesn't like the request for some reason and is killing it. That isn't something we can help you with though.

I have followed the standard method to do the http "GET" request (http request node followed by a response node). inside the http request node, i have mentioned the required URL i want access to.
i was reading something about the "HTTPnodecors"

// The following property can be used to configure cross-origin resource sharing
// in the HTTP nodes.
// See https://github.com/troygoode/node-cors#configuration-options for
// details on its contents. The following is a basic permissive set of options:
//httpNodeCors: {
// origin: "*",
// methods: "GET,PUT,POST,DELETE"
//},

is there anything to do with this?

Do you mean HTTP In node followed by a Response node? Because the HTTP Request node is a standalone node that doesn't need the response node.

You do not need to setup CORS to allow one node-red instance to make an HTTP Request of another node-red instance. CORS only applies when its a browser making the HTTP Request and in specific conditions - none of which applies here.