• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Node-Red "http in"-Node not working
Dear Armin,

i am trying to build a little webservice witch can recive XML data from clients using the "http in"-Node and the POST methode. On my normal Raspberry Pi the flow is doing its job but when it transfer it on my netPi i can not recive any messages. 

[{"id":"8a45d1e1.5db92","type":"http response","z":"e69b5c9f.49237","name":"","statusCode":"200","headers":{},"x":560,"y":120,"wires":[]},{"id":"85a4eae3.9ec5a8","type":"debug","z":"e69b5c9f.49237","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":550,"y":80,"wires":[]},{"id":"94321f38.1215a","type":"xml","z":"e69b5c9f.49237","name":"xml to obj","property":"payload","attr":"","chr":"","x":280,"y":80,"wires":[["85a4eae3.9ec5a8","7655a6d0.106238"]]},{"id":"7655a6d0.106238","type":"change","z":"e69b5c9f.49237","name":"empty","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"\"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":120,"wires":[["8a45d1e1.5db92"]]},{"id":"1e25b534.f6a0cb","type":"http in","z":"e69b5c9f.49237","name":"","url":"/test","method":"post","upload":false,"swaggerDoc":"","x":120,"y":80,"wires":[["94321f38.1215a"]]}]

Dose that maybe have something to do with a missing certificate?

kind regards,
Hello Daniel,

can you please tell me which container you are using?

You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

(June-18th-2020, 12:47 PM)Armin@netPI Wrote: Hello Daniel,

can you please tell me which container you are using?


Oh sorry i forgot: hilschernetpi/netpi-nodered
Well isn't it true that the "http in"-Node is using the port 80 for HTTP and  port 443 for HTTPS to give external applications access from outside to the Node-RED node?

But both ports are already occupied by the netPI web user interface you are using to configure netPI basic settings.

You need to reconfigure these two occupied ports away from 80 and 443 in the menu System > Port Settings.

But after you have done this please keep in mind that the web access to netPI web pages of netPI are not longer accessible at https://<netPI address:443> but at your port you have reconfigured. It happens sometimes you have forgotton that you changed it and are wondering why netPI is apparantly no longer "working" by mistake ... but is still ... under a different port.

You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

The “http in”-Node runs inside the Node-Red instance and is reachable at port 1880 with any kind of / e.g. http://localhost:1880/test (see https://cookbook.nodered.org/http/create...p-endpoint)
I found out that it must be some issue with the HTTPS certificate. I set up the example form the link above and then tried to access it using the program curl.
Below is what I got:
Curl with certificate check
curl -u admin:password
curl: (77) schannel: next InitializeSecurityContext failed: SEC_E_UNTRUSTED_ROOT (0x80090325) - Die Zertifikatkette wurde von einer nicht vertrauenswürdigen Zertifizierungsstelle ausgestellt.

Curl without certificate check
curl -u admin:password -k
       <h1>Hello World!</h1>

So, my question would be how can i set up the HTTPS certificate for the Node-Red container?

kind regards,
Ok I see. This was a good hint. I have not been working so far with the HTTP In Node, but now I know what is happening.

The implementation of our containerized Node-RED uses the HTTPS secured method to get accessible securely. In general the Node-RED "settings.js" configuration file located heer /root/.node-red/ has a special area where you can configure HTTPS and enable it. The procedure is described for examole on this web page: https://notenoughtech.com/home-automatio...o-nodered/

What I see in the source code of the Node-RED container's build file at https://github.com/HilscherAutomation/ne...Dockerfile is that the lines 98 to 110 are taking care of the settings.js file modification to enable HTTPS handling and also the generation of a self signed certificate and keys.

All relevant files are created in the container folder /root/.node-red/certs. The CA file, the private and the public key. The most relevant file for you is the /root/.node-red/certs/node-cert.pem file. This file is needed on your remote machine to tell it to trust the HTTPS site of this Node-RED instance. It is a text file and you can copy and paste its contents to a cert file on your remove machine and include it in the trusted list of certificates.

I see the followin possibilities:

a.) You could use netPIs Docker web UI and click on the running container and use the embedded console function to "jump" into the container and output the /root/.node-red/certs/node-cert.pem file on the screen using the Linux command "cat /root/.node-red/certs/node-cert.pem". Then you can copy the content.
b.) You could fork the container's source code and remove the lines from 98 to 110 and the Node-RED will not more be secured during containers build process. I don't know how familiar you are with building your own container image.
c.) You could call the curl command with the option "-k" to let it trust also untrusted self signed certificates

You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

I took a chance to extract the node-cert.pem file for you from the latest hilschernetpi/netpi-nodered:1.5.4 image tag


Here it is:

You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

And I am sorry I forgot alternative d.)

... you could of course replace all the existing files in the /root/.node-red/certs/ folder with your own files. But this might get a little complicated since the Node-RED container does not include an SSH server you could connect to via a terminal program like putty.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

ok - problem solved. As a quick workaround I just commented out the lines for the HTTPS in the "settings.js" configuration file.

Later i will either send the "node-cert.pem" file to my client or change my certificat.

Thank you so much for your exceptionally fast and reliable help!

kind regards,

Possibly Related Threads...
Thread Author Replies Views Last Post
  Fieldbus Ports not working Schoko 13 72 June-29th-2020, 09:43 PM
Last Post: Armin@netPI
  DHCP server not working m-yoshikawa 19 102 June-26th-2020, 05:39 AM
Last Post: m-yoshikawa
  using node.js on NIOT-E-TP151-EN-RE COswald 9 39 May-20th-2020, 12:54 PM
Last Post: Armin@netPI
  Error when using a node 'OpcUaServer' tad 6 38 May-12th-2020, 08:35 AM
Last Post: tad
  Node-RED log location SteveO 1 7 May-11th-2020, 07:53 PM
Last Post: Armin@netPI
  how to pick up PROFINET data and store them to OPC UA server on Node-RED/netPI. tad 7 46 March-16th-2020, 10:21 AM
Last Post: Armin@netPI
  Node Red stop working DSongra 1 11 February-12th-2020, 08:19 AM
Last Post: Armin@netPI
  After „Rebuild“ of Docker neither the node-RED nor the dashboard can be accessed MAK 4 22 January-31st-2020, 02:14 PM
Last Post: MAK
  How to save node-red flows persistent? hsammer 2 33 November-5th-2019, 03:50 PM
Last Post: hsammer
  [SOLVED] activate LED1/2 with Node-RED + fieldbus nodes container Christian_Rau 6 97 October-21st-2019, 10:30 AM
Last Post: Armin@netPI

Forum Jump:

Users browsing this thread: 1 Guest(s)