Troubleshooting http in node

I'm trying to create a pseudo REST proxy and can't even get basic functionality to work.

I have Node Red running on a RHEL 8 server in Azure. I can connect to it fine on 1880. In order to check basic functionality I have an http in node configured with /ping going to a template node with only the contents pong connected to a http out node.

If I use Postman to perform a GET request I get "Error: socket hang up". If I use CURL ON the VM I get:

$ curl http://localhost:1880/ping
curl: (52) Empty reply from server

It's probably something simple but I'm not sure what. Obviously the port is open or I couldn't access the node red interface.

image

What I'm trying to achieve is I have the CMMS Mainsaver which has a REST endpoint, but they want the payload to be Base64 encoded XML. The call will be coming from Tulip which does support XML REST calls, but not Base64 encoding.

I want Tulip to perform the request to Node Red in just XML, then I want to base64 encode the payload and then perform the request to Mainsaver on Tulip's behalf.

What am I missing?

Looking at your image, i would guess that you have it configured to a GET request and path /Ping!. But that is just a guess as i can not see how you have configured things from a image of a flow.

try http://localhost:1880/Ping!

Unfortunately not that simple... In the URL field I just have /ping.

Export that flow and paste it to a reply so people can see the code.

[
    {
        "id": "fc57aea1a9aa3b9f",
        "type": "debug",
        "z": "114c7a1d.fc85e6",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 320,
        "y": 720,
        "wires": []
    },
    {
        "id": "89db3bbf1a466ac5",
        "type": "http in",
        "z": "114c7a1d.fc85e6",
        "name": "[get] Ping!",
        "url": "/ping",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "x": 120,
        "y": 680,
        "wires": [
            [
                "7945676c9b44bde8",
                "fc57aea1a9aa3b9f"
            ]
        ]
    },
    {
        "id": "83c89f131c72a76e",
        "type": "http response",
        "z": "114c7a1d.fc85e6",
        "name": "Proxy Response",
        "statusCode": "",
        "headers": {},
        "x": 560,
        "y": 680,
        "wires": []
    },
    {
        "id": "7945676c9b44bde8",
        "type": "template",
        "z": "114c7a1d.fc85e6",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "Pong!",
        "output": "str",
        "x": 320,
        "y": 680,
        "wires": [
            [
                "83c89f131c72a76e"
            ]
        ]
    }
]

Is NR on the same VM that you are running the curl on?

I installed Your flow on my local machine (IP 192.168.1.45) and both the curl and a http://localhost:1880/ping or http://192.168.1.45:1880/ping in a browser worked fine.

Going to another machine both the curl and http://192.168.1.45:1880/pingin a browser worked fine.

That brings it back to the VM. Not having any experience wth Azure, I'll have to bow out here.

I plan to do an update/restart of Node Red, but I have to wait until Sunday as this instance is used in production.

Wooo, testing in production. I too like to live dangerously.

Well, there's two things to that... :slight_smile:

  1. This was supposed to be my development server but we ended up solving problems and currently have no where to "export" the solution.
  2. We're working on setting up an Azure IoT instance where I can hopefully dockerize each "solution" so they run independently.
1 Like

So I got it working, turns out I had to do https:// instead of http://.

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