[nginx] internal location keepalive_requests issue
baidu
crasyangel at 163.com
Sat Aug 27 10:08:28 UTC 2016
location /hls {
error_page 404 = @hls;
keepalive_requests 1000;
}
location @hls {
# Serve HLS fragments
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp;
add_header Cache-Control no-cache;
keepalive_requests 1000;
}
keepalive_requests must be large enough in this two location meanwhile
if set keepalive_requests to 0 or 1 in /hls, keepalive_requests would not work in @hls
if (r->keepalive) {
if (clcf->keepalive_timeout == 0) {
r->keepalive = 0;
} else if (r->connection->requests >= clcf->keepalive_requests) {
r->keepalive = 0;
} else if (r->headers_in.msie6
&& r->method == NGX_HTTP_POST
&& (clcf->keepalive_disable
& NGX_HTTP_KEEPALIVE_DISABLE_MSIE6))
{
/*
* MSIE may wait for some time if an response for
* a POST request was sent over a keepalive connection
*/
r->keepalive = 0;
} else if (r->headers_in.safari
&& (clcf->keepalive_disable
& NGX_HTTP_KEEPALIVE_DISABLE_SAFARI))
{
/*
* Safari may send a POST request to a closed keepalive
* connection and may stall for some time, see
* https://bugs.webkit.org/show_bug.cgi?id=5760
*/
r->keepalive = 0;
}
}
Note r->keepalive only effect that Connection filed in response header and set keepalive timer when finalize request.
Why place this code block in ngx_http_update_location_config? Would be better place it where set keepalive timer?
And sometimes nginx would send "Connection: keep-alive", but close connection in 1.10.1 version, and this would be nothing seriously
So why is it the expected behaviour?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20160827/2d163b30/attachment.html>
More information about the nginx-devel
mailing list