Http redirect to https

Hi,
I have enabled https, but when I try to access http://mysite.com:1880 I would like it to be redirect to https://mysite.com:1880 , how can I do that?

Because Node-RED uses the same port number whether you are using http or https, there is no simple way to do a redirection.

Really, you need a proxy server - typically a web server such as NGINX or Apache - that will redirect for you.

As you seem to be accessing Node-RED over the Internet, you could remove the need for a port number and rely on the default ports (http=80, https=443) which you could easily redirect using a proxy server.

Thank you :+1:

You can use the iptables for redirect the ports like bellow.

sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 1880
1 Like