My node.js application gets a random error event accidentally when writing requests after I put it on nginx

I am running node.js (0.8.20 and 0.9.10) on a Windows 2012 server. I have been running without problems for several weeks. It was without Nginx (1.2.6) in front. With nginx, the front is configured like this:

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
worker_connections  1024;
}


http {
include       mime.types;
default_type  application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;

upstream dem2 {
    server 127.0.0.1:8080;
}

server {
    listen 80;
    server_name dem2.cz dem2;
    access_log /nginx-1.2.6/logs/dem2.log;
    location / {
        #proxy_pass http://127.0.0.1:8080/;
        proxy_pass http://dem2/;
        proxy_set_header  X-Real-IP  $remote_addr;
        proxy_redirect off;
    }
}   

server {
    listen 80;
    server_name localhost;

    location / {
        root   html;
        index  index.html index.htm;
    }

}

}

In requests, I accidentally get this error in the node.js app:

events.js:69
    throw arguments[1]; // Unhandled 'error' event
                   ^
Error: socket hang up
    at createHangUpError (http.js:1383:15)
    at ServerResponse.OutgoingMessage._writeRaw (http.js:499:26)
    at ServerResponse.OutgoingMessage._send (http.js:466:15)
    at ServerResponse.OutgoingMessage.end (http.js:911:18)
    at SendStream.notModified (C:\dem2cz_node_app\node_modules\express\node_modules\send\lib\send.js:223:7)
    at SendStream.send (C:\dem2cz_node_app\node_modules\express\node_modules\send\lib\send.js:353:17)
    at SendStream.pipe     (C:\dem2cz_node_app\node_modules\express\node_modules\send\lib\send.js:322:10)
    at Object.oncomplete (fs.js:93:15)

Process finished with exit code 1

I suspect that I have something incorrectly configured in Nginx, but I'm sure I don't know what the hell it could be. Can anyone advise please?

I can publish the node.js code if you want, but nothing has been invented, just 100 lines of express application for serving static AngularJS files with the ability to serve HTML generated in PhantomJS when there is a bot.

+1
1

0.8.20 , "http hang-up", . . @robertkelp, , error, http, .

+1

All Articles