Answer the question
In order to leave comments, you need to log in
How to proxy websocket (recommendations that I found do not help)?
Good day.
I can't proxy websocket in any way. The connection goes through the port (ws://api.domain.com:3501), but not through the proxied port 80 (ws://api.domain.com). Can anyone suggest what could be the issue? Where could I go wrong?
nginx config
server {
listen 80;
root /var/www/domains/domain.com;
server_name api.domain.com;
location / {
proxy_pass http://127.0.0.1:3501;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
#...
[error] 17984#0: *25 connect() failed (111: Connection refused) while connecting to upstream,
client: 10.0.0.185, server: api.domain.com, request: "GET / HTTP/1.0",
upstream: "http://127.0.0.1:3501/", host: "api.domain.com"
Answer the question
In order to leave comments, you need to log in
Tried
netstat below
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:8888 0.0.0.0:* LISTEN 112/python
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 533/master
tcp 0 0 0.0.0.0:1443 0.0.0.0:* LISTEN 110/python
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/init
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 660/nginx: master p
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 228/sshd
tcp6 0 0 ::1:25 :::* LISTEN 533/master
tcp6 0 0 :::3306 :::* LISTEN 225/mysqld
tcp6 0 0 :::3501 :::* LISTEN 902/node
tcp6 0 0 :::80 :::* LISTEN 660/nginx: master p
tcp6 0 0 :::21 :::* LISTEN 552/proftpd: (accep
tcp6 0 0 :::22 :::* LISTEN 228/sshd
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question