Websocket [socket.io] not working with NGINX Proxy
See original GitHub issueHi, I have a dashboard build and working fine with uibuilder, problem i`m facing is where i try to display it via nginx reverse proxy - i can see dashboard ok but the data to dashboard is not being displayed as developer tools shows that websocket connection is not established so nothing goes through.
My nginx config:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
disable_symlinks off;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
include /etc/nginx/conf.d/*.conf;
server{
listen 80;
listen [::]:80;
location / {
proxy_pass http://localhost:1880/uibuilder/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
#rediretion for static resources
location /uibuilder/ {
proxy_pass http://localhost:1880/uibuilder/;
}
#redirection for socket connections
location /socket.io/ {
proxy_pass http://localhost:1880/uibuilder/vendor/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Any help on this would be much appreciated !
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Behind a reverse proxy | Socket.IO
You will find below the configuration needed for deploying a Socket.IO server behind a reverse-proxy solution, such as: NginX; Apache HTTPD ...
Read more >Socket.io not working with nginx reverse proxy? - Stack Overflow
I'm trying to use socket.io with my nginx reverse proxy server, but it seems not working.. Chrome showing this wonderful waterfall:.
Read more >Using NGINX with Node.js and Socket.IO, the WebSocket API
Learn how to use NGINX and NGINX Plus to proxy applications built on Node.js and Socket.IO, a popular WebSocket API.
Read more >Make Node.js + socket.io + Angular + Nginx + SSL work
Recently, I built a messaging application with Angular, socket.io and express.js. It worked properly on localhost on my local machine.
Read more >Can't get socket.io to work behind reverse proxy - Help
3. The problem I'm having: I am trying to run a create-react-app dev server and a nodejs-koa server behind the reverse proxy.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Your wish is my command!
If you install uibuilder manually using
npm install totallyinformation/node-red-contrib-uibuilder#express
, you will get a new branch that lets you specify a port in settings.js. If you specify a port that is different to Node-RED’s, you will get uibuilder on a custom webserver.I still need to test https but if you are using NGINX to do https termination, this won’t bother you.
Assuming my tests on my live platform work out OK, I’ll be putting it live as v3.3.0 very soon.
i`ll give it a go - Having uibuilder as a separate Express app would be a killer feature !