Weird Httpstatic configuration in Setting.js in NR windows 11

Node.red 3.0.2, Windows 11 Pro, Nodes v. 16.17

Hi,
My flow uses the template node with images stored inside a "domotica" folder inside ".node-red" folder inside current user "rober" folder.

As you can see underlined in yellow in Settings.png file I uncommented the HTTPStatic line in Settings.js in order to show them in template node, writing with Notepad editor:

httpStatic: 'C:\Users\rober\.nodered\domotica\'

but in the dashboard template I always see the broken link icon!

When starting node-red I see a "dirty" httpstatic parameter reading (underlined in yellow in Httpstatic.png):

C:\Users\rober.node-red\domotica > /

the parameter is not correctly terminated with the expected windows PATH identifier "\", but is concatenated by a weird " > /" string. Is this the reason why the Httpstatic is not correctly configured?

I understand that the problem lies here, but I don't know how to solve it. Should I replace the Settings.js in the User/.node-red/ with the original one installed in User/AppData/Roaming/npm/Node_Modules/node-red?

TIA

No, if you use a proper editor you would see that is simply a comment...

Where is this particular file? in .node-red or in User/AppData/Roaming/npm/Node_Modules/node-red?

The highlighted text is stating that files in C:\Users\rober.node-red\domotica > will be presented to the browser > at path /

For example, you could set the httpStaticRoot to "my_web_stuff" and it would show you...
C:\Users\rober\.node-red\domotica > /my_web_stuff/


As of NR 3, you can also do this...

httpStatic: [{path:'C:\\Users\\rober\\.node-red\\domotica', root: "/docs/"}]

and you will be shown...
C:\Users\rober\.node-red\domotica > /docs/

Hi Steve,
The file I edited is in .node-red folder

Ok. That's the right one. Does my explanation help you?

Unfortunately no Steve, I keep on seeing all images inside the template node with the "broken link" icon.
If I type the full path of the image on the browser:

C://Users/rober/.node-red/domotica/myImage.png

I can see it

I'm trying to paste some html code here to let you see my code, but in the body message preview the html is always interpreted. I can avoid it and passing it as pure text?

Use the code button </> before posting code

Inside the template node the images have a tag : "IMG SRC = "/MyImage.png".
I also tried "IMG SRC = "MyImage.png" without the forward slash to no avail.

BTW this flow has been moved from a Raspberry Pi machine where it still works perfectly. It's on Windows 11 only where I have this problem

Can you show content of the folder? Is that file present? Have you checked file permissions? What account runs node-red?

Can you show content of the folder? YES

Is that file present? YES, the browser can display it

Have you checked file permissions? Read/Write on all files in folder "domotica"

What account runs node-red? How can I see which "account" owns the node-red process? If it's installed in "rober" folder user the account should be the same

You can see the owner of the process using the Windows Task Manager. Switch to the Details tab to see the username. Mostly they will be your logged in user or SYSTEM.

The address in use error is because you did not stop node red before starting it again, so the old settings file is still in use.

Thank you very much. In the details tab I found that the node task is owned by SYSTEM.
Has it something to do with the fact that the template node cannot see the images contained in the folder referenced by HTTPStatic?

Roberto

Hi Colin,
I restarted the pc everytime I did a modification to the settings.js file

Hi Steve,
from Task Manager details I see that node.exe is run by SYSTEM and this user has all the privileges on the images folder I struggle to see

If node-red is ran by system I suggest you try putting the images somewhere more system friendly.

Try for example, put your images in c:\node-red\images and set httpStatic accordingly

Be sure to check system has at least read access to c:\node-red\images

Hi Steve,
I moved the "domotica" folder at root level C:\ and edited the settings.js accordingly:

httpStatic: 'C:/domotica/'

restarted node-red and seen the correct Static path:

C:/domotica > /

where all content should be accessible from the "/" root

I verified that the SYSTEM user who owns the node.exe process has all privileges on domotica folder
and all contained files

I made a super simple flow with one inject and a template node with this code:

<div> 
    Test png
    <img alt="Image not found" src ="/schemaloex.png" />   
</div> 

where "schemaloex.png" is one of the images inside "domotica"
I inject the timestamp to run the template node but, as you can see, the image is not found.

I enclose the flow so you can check if I have made some erroneous configuration:

[
    {
        "id": "6027b4bab948526f",
        "type": "ui_template",
        "z": "641efd2eb7d562cf",
        "group": "63b3eeadbccc9412",
        "name": "SchemaLOEX",
        "order": 1,
        "width": "7",
        "height": "10",
        "format": "<div> \n    Test png\n    <img alt=\"Image not found\" src =\"/schemaloex.png\" />   \n</div>   \n",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "className": "",
        "x": 540,
        "y": 1280,
        "wires": [
            []
        ]
    },
    {
        "id": "c51c11f3c74b761a",
        "type": "inject",
        "z": "641efd2eb7d562cf",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 240,
        "y": 1280,
        "wires": [
            [
                "6027b4bab948526f"
            ]
        ]
    },
    {
        "id": "63b3eeadbccc9412",
        "type": "ui_group",
        "name": "Termoregolazioni nei Piani",
        "tab": "9ebecd5c9ef57a7e",
        "order": 2,
        "disp": true,
        "width": "7",
        "collapse": false
    },
    {
        "id": "9ebecd5c9ef57a7e",
        "type": "ui_tab",
        "name": "Comfort",
        "icon": "dashboard",
        "order": 4,
        "disabled": false,
        "hidden": false
    }
]

I'm really desperate and frankly I don't know which other test/configuration I can make in order to be able to display images on template node via dashboard.
Two things have changed moving the project from NR 1.x on a Raspberry Pi:

  • NR version from 1 to 3.2
  • platform from Raspberry to Windows

but I don't know what to blame.

I would like to add that the only way I was able to see the image "schemaloex.png" was using a file node pointing to that image, converted to base64 and passed as msg.payload to the template using this flow:

[
    {
        "id": "76f9c28c.8d324c",
        "type": "inject",
        "z": "9519c5e5bc8dfe67",
        "name": "",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 300,
        "y": 860,
        "wires": [
            [
                "91ff3a3e.591a38"
            ]
        ]
    },
    {
        "id": "696f92ca.600a9c",
        "type": "ui_template",
        "z": "9519c5e5bc8dfe67",
        "group": "63b3eeadbccc9412",
        "name": "",
        "order": 1,
        "width": "7",
        "height": "8",
        "format": "\n prova con base64\n <img width=\"100%\" height=\"100%\" alt=\"Image not found\" src=\"data:image/png;base64,{{msg.payload}}\" />\n",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": false,
        "templateScope": "local",
        "className": "",
        "x": 1030,
        "y": 860,
        "wires": [
            []
        ]
    },
    {
        "id": "91ff3a3e.591a38",
        "type": "file in",
        "z": "9519c5e5bc8dfe67",
        "name": "",
        "filename": "C:\\domotica\\schemaloex.png",
        "filenameType": "str",
        "format": "",
        "chunk": false,
        "sendError": false,
        "encoding": "none",
        "allProps": false,
        "x": 570,
        "y": 860,
        "wires": [
            [
                "e66563f4.00136"
            ]
        ]
    },
    {
        "id": "e66563f4.00136",
        "type": "base64",
        "z": "9519c5e5bc8dfe67",
        "name": "",
        "action": "str",
        "property": "payload",
        "x": 850,
        "y": 860,
        "wires": [
            [
                "696f92ca.600a9c"
            ]
        ]
    },
    {
        "id": "63b3eeadbccc9412",
        "type": "ui_group",
        "name": "Termoregolazioni nei Piani",
        "tab": "9ebecd5c9ef57a7e",
        "order": 2,
        "disp": true,
        "width": "7",
        "collapse": false
    },
    {
        "id": "9ebecd5c9ef57a7e",
        "type": "ui_tab",
        "name": "Comfort",
        "icon": "dashboard",
        "order": 4,
        "disabled": false,
        "hidden": false
    }
]

At least we know that this image exists, is readable, but not thru the template node.
As you can well imagine I cannot pass all my images reading from them from file system, converting as base64 streams and passing as objects whereas before I just typed their name!

Do you personally use NR on a Windows 11 machine?

Please help!

If you put http://IP:1880/schemaloex.png in a browser window does it work?

I dont know what to say - It works as expected...

The template content

<div>
    HTML: <pre> &lt;img alt="Image not found" src ="/schemaloex.png" /&gt; </pre>
    <img alt="Image not found" src ="/schemaloex.png" />   
</div>   

Directory

image

Settings file...

    httpStatic: 'c:/domotica',

Dashboard Result



There is no need to inject anything at all. Injecting into ui-template node is for dynamic runtime changes.

What I showed you above was jut 1 single unconnected ui-template node
image



What does your browsers devtools reveal?