Reputation: 11
I have searched extensively for what seems a rather simple question but found no answers. Does anybody know how to reference a webpage created in Node Red running on IBM Bluemix? Here is my flow...
My http in node is referencing "/temp1" but when I type my bluemix address with "/temp1" at the end I get the error "Cannot GET /temp1". This seems so remedial I am sure that it is just a setting or missing characters in the reference. Thank you so much for your help. Here is my web page html by the way...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Test Home HVAC Zone Control</title>
</head>
<body>
<h2>
WebSocket Test
</h2>
Outside Temperature: <input id="display_external_temperature" type="text" value="0"></input><br>
Media Room:<br>
Set Temperature: <input id="mr_set_temp" type="text" value="0"></input><br>
Current Temperature: <div id="mr_temp">0</div><br>
Humidity: <div id="mr_humidity">0</div><br>
DC Voltage: <div id="mr_vcc">0</div><br>
Status: <div id="status">unknown</div>
</body>
</html>
Upvotes: 1
Views: 74
Reputation: 2836
You need to set an appropriate header, add for example a function node after your html one with:
msg.headers={"Content-Type":"text/html"}
return msg;
Here is a modified flow:
[{"id":"d6ed730e.41fab8","type":"http in","z":"f0084239.95c63","name":"/temp","url":"/temp","method":"get","swaggerDoc":"","x":88.5,"y":425.40000915527344,"wires":[["6b3a011d.14e8d"]]},{"id":"6b3a011d.14e8d","type":"template","z":"f0084239.95c63","name":"html","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\">\n<html>\n <head>\n <title>Test Home HVAC Zone Control</title>\n </head>\n <body>\n <h2>\n WebSocket Test\n </h2>\n Outside Temperature: <input id=\"display_external_temperature\" type=\"text\" value=\"0\"></input><br>\n Media Room:<br>\n Set Temperature: <input id=\"mr_set_temp\" type=\"text\" value=\"0\"></input><br>\n Current Temperature: <div id=\"mr_temp\">0</div><br>\n Humidity: <div id=\"mr_humidity\">0</div><br>\n DC Voltage: <div id=\"mr_vcc\">0</div><br>\n Status: <div id=\"status\">unknown</div>\n\n\n </body>\n</html>","x":283.49998474121094,"y":416.40000915527344,"wires":[["9ac696a6.89a578"]]},{"id":"9ac696a6.89a578","type":"function","z":"f0084239.95c63","name":"setHTTPheader","func":"msg.headers={\"Content-Type\":\"text/html\"}\nreturn msg;","outputs":1,"noerr":0,"x":514.2000122070312,"y":419.20001220703125,"wires":[["dc5c1338.e50888"]]},{"id":"dc5c1338.e50888","type":"http response","z":"f0084239.95c63","name":"/temp","x":745.4999847412109,"y":405.8000030517578,"wires":[]}]
Upvotes: 0