# Is it possible to use NodeRED as functioning LAN https server?

**URL:** <https://discourse.nodered.org/t/is-it-possible-to-use-nodered-as-functioning-lan-https-server/8078>\
**Category:** General\
**Created:** [17 February 2019 21:54 UTC](https://discourse.nodered.org/t/is-it-possible-to-use-nodered-as-functioning-lan-https-server/8078 "2019-02-17T21:54:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [17 February 2019 21:54 UTC](https://discourse.nodered.org/t/is-it-possible-to-use-nodered-as-functioning-lan-https-server/8078/1 "2019-02-17T21:54:27Z")

</div>

I'm currently running a python https webserver to handle requests from Scratch 3 to control GPIO pins

I'm wondering if I could use NodeRED as an alternative?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [17 February 2019 21:58 UTC](https://discourse.nodered.org/t/is-it-possible-to-use-nodered-as-functioning-lan-https-server/8078/2 "2019-02-17T21:58:36Z")

</div>

Hi @cymplecy

yes - the HTTP In nodes can be used to make flows triggered by http requests - [https://cookbook.nodered.org/http/](https://cookbook.nodered.org/http/)

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [17 February 2019 22:13 UTC](https://discourse.nodered.org/t/is-it-possible-to-use-nodered-as-functioning-lan-https-server/8078/3 "2019-02-17T22:13:11Z")

</div>

I know it can handle http requests but I wondering whether it handle https requests with some locally generated SSL certs?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [17 February 2019 22:14 UTC](https://discourse.nodered.org/t/is-it-possible-to-use-nodered-as-functioning-lan-https-server/8078/4 "2019-02-17T22:14:31Z")

</div>

Ah sorry - didn't realise it was the https bit specifically. Yes, you can get node-red to accept https requests - search your settings.js for https

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [17 February 2019 22:39 UTC](https://discourse.nodered.org/t/is-it-possible-to-use-nodered-as-functioning-lan-https-server/8078/5 "2019-02-17T22:39:04Z")

</div>

Ta -I'll have a play then 🙂

---

<div class="post-metadata">

**Author:** ![Robbo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/robbo/32/4491_2.png) [@Robbo](https://discourse.nodered.org/u/Robbo)\
**Post date:** [18 February 2019 10:16 UTC](https://discourse.nodered.org/t/is-it-possible-to-use-nodered-as-functioning-lan-https-server/8078/6 "2019-02-18T10:16:49Z")

</div>

You can also get a reverse proxy like NGINX to terminate the SSL, which may be more secure if you plan on making it externally accessible from the Internet.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [18 February 2019 10:28 UTC](https://discourse.nodered.org/t/is-it-possible-to-use-nodered-as-functioning-lan-https-server/8078/7 "2019-02-18T10:28:26Z")

</div>

Pure LAN application but thanks 🙂

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [27 February 2019 10:05 UTC](https://discourse.nodered.org/t/is-it-possible-to-use-nodered-as-functioning-lan-https-server/8078/8 "2019-02-27T10:05:11Z")

</div>

Seems that I might not need an HTTPS server in the first place!

> <https://twitter.com/cymplecy/status/1100696758332678146>

I've been redirecting Scratch 3 translate calls to a python HTTPS server but wanted to try out making a NodeRED one instead

I had believed that once a browser makes an HTTPS request, if it got redirected, then the alternative server also needed to be HTTPS as well but seemingly not 🙂

I think I got the (wrong) idea from trying to make a call from a modified .js script running on the Scratch HTTPS site to a http server and failing - so I just assumed that re-directs also needed to go to an HTTPS server

Happy to be wrong 🙂

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 March 2019 11:31 UTC](https://discourse.nodered.org/t/is-it-possible-to-use-nodered-as-functioning-lan-https-server/8078/9 "2019-03-02T11:31:36Z")

</div>

Spoke too soon ☹  
Everything worked without https when Scratch 3 running in browser on same machine as NodeRED but when trying to use across a LAN - it wanted webserver to be https again

So I edited my settings .js like this

```auto
...
// The `https` setting requires the `fs` module. Uncomment the following
// to make it available:
var fs = require("fs")
...
    https: {
        key: fs.readFileSync('ca.key'),
        cert: fs.readFileSync('ca.pem')
    },
...
    httpNodeCors: {
        origin: "*",
        methods: "GET,PUT,POST,DELETE"
    },
...

```

(my ssl certs are available here [https://github.com/cymplecy/scratch\_gpio/tree/v8](https://github.com/cymplecy/scratch_gpio/tree/v8) - stick them into /home/pi/.node-red)

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [2 March 2019 13:24 UTC](https://discourse.nodered.org/t/is-it-possible-to-use-nodered-as-functioning-lan-https-server/8078/10 "2019-03-02T13:24:13Z")

</div>

I'm thinking - can I get away with a double hop?  
i.e NodeRED http server on main computer localhost - communicating on side channel to NodeRED on the Pi - and relaying back again

......
