Search code examples
node-red

Node red httpstatic not working


Kinda new to node-red, still puzzling on how to serve the static files

in setting.js, i had set the httpstatic to point onto a folder

 httpStatic: 'C:\public',

in the folder, it contain a file name sprite.png

i had restart node red, and run the testing page which the node have

msg.payload = "<html>Test</html><img src=\"sprite.png\"></html>"
return msg;

still i hit file not found

GET http://localhost:1880/sprite.png 404 (Not Found)

what actually goes wrong?


Solution

  • You need to escape the \ character in the path:

    httpStatic: 'C:\\public',