Welcome! Log In Create A New Profile

Advanced

Nginx, Node.JS and socket.io 504 timeout

October 01, 2013 11:22AM
Здравствуйте!

Nginx config

server {
listen *:80;
server_name live.domain.com;

server_tokens off;
charset utf-8;

error_log /var/log/nginx/live-error.log info;
access_log /var/log/nginx/live-access.log;

location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:1337;
proxy_redirect off;
}
}

Node.js отлично работает с таким конфигом.
Но если node.js выключен, то по ссылке http://live.domain.com/socket.io/socket.io.js я ожидаю какое-то время(read_timeout) и потом получаю 504 ошибку.

Мне надо сделать так, чтобы если node,js выключен и клиент обращается к адресу http://live.domain.com/socket.io/socket.io.js , то ему СРАЗУ же выдается либо 404, либо 502 (что должно быть логично)
Иначе я не понимаю как быть если node.js отвалился, а у пользователя не грузится страница из-за того, что js по указанному пути ожидает таймаута.

Спасибо!
Subject Author Posted

Nginx, Node.JS and socket.io 504 timeout

Kirill October 01, 2013 11:22AM

Re: Nginx, Node.JS and socket.io 504 timeout

Валентин Бартенев October 01, 2013 11:42AM

Re: Nginx, Node.JS and socket.io 504 timeout

Maxim Dounin October 01, 2013 11:46AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 313
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready