title: Elasticsearch : Connection refused while connecting to upstream
body: <p>I've set up an Elasticsearch server with Kibana to gather some logs.</p>
  
  <p>Elasticsearch is behind a reverse proxy by Nginx, here is the conf :</p>
  
  <pre><code>server {   
    listen   8080;   
    server_name myserver.com; 
    error_log   /var/log/nginx/elasticsearch.proxy.error.log;
    access_log  off;
  
    location / {
  
      # Deny Nodes Shutdown API
      if ($request_filename ~ "_shutdown") {
        return 403;
        break;
      }
  
      # Pass requests to ElasticSearch
      proxy_pass http://localhost:9200;
      proxy_redirect off;
      proxy_http_version 1.1;
      proxy_set_header Connection "";
  
      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;
  
      # For CORS Ajax
      proxy_pass_header Access-Control-Allow-Origin;
      proxy_pass_header Access-Control-Allow-Methods;
      proxy_hide_header Access-Control-Allow-Headers;
      add_header Access-Control-Allow-Headers 'X-Requested-With, Content-Type';
      add_header Access-Control-Allow-Credentials true;
  
    }
  
  }
  </code></pre>
  
  <p>Everything works well, I can <code>curl -XGET "myserver.com:8080"</code> to check, and my logs come in.</p>
  
  <p>But every minute or so, in the nginx error logs, I get that :</p>
  
  <pre><code>2014/05/28 12:55:45 [error] 27007#0: *396 connect() failed (111: Connection refused) while connecting to upstream, client: [REDACTED_IP], server: myserver.com, request: "POST /_bulk?replication=sync HTTP/1.1", upstream: "http://[::1]:9200/_bulk?replication=sync", host: "myserver.com"
  </code></pre>
  
  <p>I can't figure out what it is, is there any problem in the conf that would prevent some <code>_bulk</code> requests to come through ? </p>