Welcome! Log In Create A New Profile

Advanced

keepalive_timeout, proxy_send_timeout, and proxy_read_timeout ignored

July 13, 2015 01:40PM
Hi, I'm using AWS Beanstalk with nginx in front of a Puma server serving Ruby on Rails. I have one URL that is for an EventSource so it is kept alive and data is streamed out. I was running into this problem http://forum.nginx.org/read.php?2,237386,237386 where when the client closes the browser but nginx keeps the connection alive forever so I tried having nginx automatically close the connection after 5 seconds. I set keepalive_timeout, proxy_send_timeout, and proxy_read_timeout all to 5 seconds but all were ignored. The connection remained open until nginx was restarted.

# nginx config

upstream my_app {
server unix:///var/run/puma/my_app.sock;
}

server {
listen 80;
server_name _ localhost; # need to listen to localhost for worker tier

if ($http_x_forwarded_proto = "http") { return 301 https://$host$request_uri; }

location /dashboard_stream {
proxy_pass http://my_app; # match the name of upstream directive which is defined above
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering off;
proxy_cache off;
proxy_http_version 1.1;
proxy_set_header Connection '';
chunked_transfer_encoding off;
keepalive_timeout 5s;
proxy_send_timeout 5s;
proxy_read_timeout 5s;
}
}

# nginx version
nginx version: nginx/1.6.2

# AWS linux version
NAME="Amazon Linux AMI"
VERSION="2015.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2015.03"
PRETTY_NAME="Amazon Linux AMI 2015.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2015.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
Amazon Linux AMI release 2015.03

# kernel version
Linux ip-172-31-12-138 3.14.42-31.38.amzn1.x86_64 #1 SMP Wed May 13 20:33:05 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Subject Author Posted

keepalive_timeout, proxy_send_timeout, and proxy_read_timeout ignored

dgobaud July 13, 2015 01:40PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 76
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready