3

Greetings I am configuring a node-red server and after apply Nginx redirect I got the following issue.

Image of node-red trying to reconnect and still deploying

After Using Nginx to redrect subdomain node-red.domain.com to localhost:1880

Nginx redirect config:

server {
        listen 80;
        server_name sub1.domain.com;

        location / {
                proxy_pass "https://127.0.0.1:8080";
        }
}
server {
        listen 80;
        server_name sub2.domain.com;

        location / {
                proxy_pass "https://127.0.0.1:8080";
        }
}

Please anyone can help me on that?

Nikolai Shevchenko
  • 7,083
  • 8
  • 33
  • 42

2 Answers2

10

You need to enable WebSocket proxying to allow the editor to connect back to the runtime.

To do that you need to add some additional options to your location configs:

    location / {
        proxy_pass "https://127.0.0.1:8080";
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

For more information about NGINX and WebSockets, refer to the documentation here.

knolleary
  • 9,777
  • 2
  • 28
  • 35
2

The same works in Synology NAS:

Here under Application Portal => Create a reverse Proxy for http://*:1880 or https://*1880

And add in the register Customer Header: Create WebSocket

This will create the following two settings: Upgrade $http_upgrade; Connection "upgrade";

And voila no connection lost from inside of the LAN and also from outside.