Niels
Niels

Reputation: 609

Nginx: Couldn't forward the HTTP response back to the HTTP client

I have a server with the next components:

I'm running a Ruby on Rails app on this server. Now in my error.log of Nginx I found this error popping up regularly.

[ pid=12615 thr=3065355072 file=ext/nginx/HelperAgent.cpp:923 time=2012-10-22 09:31:03.929 ]: Couldn't forward the HTTP response back to the HTTP client: It seems the user clicked on the 'Stop' button in his browser.

Does anybody has an idea where this issue comes from? This is my Nginx conf:

user deployer staff;
worker_processes  5;

error_log  /var/log/nginx/error.log notice;
pid        /var/log/nginx/nginx.pid;

events {
    worker_connections  2048;
    multi_accept on;
}

http {
    passenger_root /var/lib/gems/1.9.1/gems/passenger-3.0.15;
    passenger_ruby /usr/bin/ruby1.9.1;

    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  /var/log/nginx/access.log  main;

    sendfile        on;

    keepalive_timeout  65;

    server {
        passenger_enabled on;
        server_name xxx.com;
        listen       80;
        rails_env production;

        location ^~ /assets/ {
            gzip_static on;
             expires max;
             add_header Cache-Control public;
        }

        root /var/rails/alfa_paints/current/public;
        error_page  404              /404.html;

        error_page   500 502 503 504  /500.html;
    }
}

Upvotes: 0

Views: 1795

Answers (2)

comme
comme

Reputation: 76

another situation maybe like this nginx Timeout serving large requests

to resolve this problem,you can try this:

 gem install passenger #use the lastest passenger
 passenger-config --root # get passenger_root_path
 #download the lastest nginx file and cd nginx-X.X.X
 ./configure --with-http_ssl_module --with-http_gzip_static_module --with-cc-opt=-Wno-error --add-module=$passenger_root_path/ext/nginx
 make
 make install

after this, config nginx.conf and restart,you will find everything is ok!

Upvotes: 0

dpassage
dpassage

Reputation: 5453

You configuration looks fine. I think the error is exactly what it says: the end user clicked "stop" on their browser, closing the TCP connection to the server. Everything in your application stack is likely working as designed. Unless you have end users complaining about the app not working, that's the most likely explanation.

That said, if you're seeing this error a lot, the next question you might ask is "why are users hitting the stop button so much"? Maybe part of your application is taking too long to respond to users, and you need to either speed it up or add some sort of progress indicator. You might look back at your logs and see if you can correlate the errors with a particular kind of request.

Upvotes: 1

Related Questions