So I have a small Raspberry Pi on my local network that I use to host a server. It is a fairly simple setup, with nginx and my npm-hosted server stood up in containers using docker-compose.
my npm server listens to port 30000.
Here is my nginx setup
server {
# Listen on port 80
listen 80;
listen [::]:80;
# Sets the Max Upload size to 100 MB
client_max_body_size 100M;
# Enable compression
gzip on;
gzip_disable "MSIE [1-6]\.";
gzip_comp_level 6;
gzip_min_length 1024;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
<a bunch of gzip types>
# Proxy Requests to server
location / {
# Set proxy headers
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# These are important to support WebSockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
# Make sure to set your port number
proxy_pass http://npmServer:30000;
}
}
When I am serving static content I have no problem. But when I am trying to connect to ws://<PiIP>/socket.io/...
I get a connection failed message in my browser terminal, and when I check my logs in docker compose, I see a bunch of connect() failed (111: Connection Refused)
errors.
Is there a way to add a socket.io location somehow? I have even spoken to some folks who are hosting the same npm-based project using the exact same setup, and they also have no idea what is going on.
/socket.io
in the path forws
connections?