Empty reply from server - creating an HTTP Endpoint

I am trying to create an HTTP Endpoint using the description provided here: https://cookbook.nodered.org/http/create-an-http-endpoint
Using the example code together with the mentioned curl-command I get the reply "curl: (52) Empty reply from server".
I am using a Debian operated local system an I have installed node-red using the description provided here: https://nodered.org/docs/getting-started/raspberrypi
What am I doing wrong?
Many thanks!

Difficult to say without more info...

  • Share your flow
  • Share your curl command

NOTE: Please wrap code in a code fence to avoid forum formatting making flow/curl command unusable.
```
like this, between back ticks
```

I am using 1:1 the example provided here: https://cookbook.nodered.org/http/create-an-http-endpoint

Flow: [ { "id": "8fb7704d922a7884", "type": "tab", "label": "Flow 1", "disabled": false, "info": "", "env": [] }, { "id": "59ff2a1.fa600d4", "type": "http in", "z": "8fb7704d922a7884", "name": "", "url": "/hello", "method": "get", "swaggerDoc": "", "x": 100, "y": 180, "wires": [ [ "54c1e70d.ab3e18" ] ] }, { "id": "54c1e70d.ab3e18", "type": "template", "z": "8fb7704d922a7884", "name": "page", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "<html>\n <head></head>\n <body>\n <h1>Hello World!</h1>\n </body>\n</html>", "x": 250, "y": 180, "wires": [ [ "266c286f.d993d8" ] ] }, { "id": "266c286f.d993d8", "type": "http response", "z": "8fb7704d922a7884", "name": "", "x": 390, "y": 180, "wires": [] } ]

URL command: root@nodered:~# curl http://localhost:1880/hello curl: (52) Empty reply from server root@nodered:~#

What you have posted works perfectly fine for me...

image

image

Question...

  • Why are you running curl as root user?
  • Are you using the node-red-start command to start node-red
    • in other words, what user is running node-red? If you used the installer script, then it would be installed as PI or the user you initially ran the script as.

Many thanks for your help!

No special reason for this. Simply because I log on to the machine via SSH as root@...

I have installed Node-Red as root and as described here: Running on Raspberry Pi : Node-RED (nodered.org)
I run Node-Red as a service and I have enabled Autostart on boot as described in the above document with the following command: sudo systemctl enable nodered.service

I have tried now not to start node-red as a service but to start manually as root: Same result.
I also have tried to change port 1880 to 80 in the settings file: Same result too.
Where else can I look? I am very grateful for any help!

The problem seems to be in the settings for https: As soon as I specify a "key" and a "cert" under "https", the Node-Red server only accepts https connections, even if I set "requireHttps" to "false".
Is this the way it should be?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.