Welcome! Log In Create A New Profile

Advanced

[nginx] internal location keepalive_requests issue

August 27, 2016 06:10AM
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?

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Stream: the $session_time variable.

Vladimir Homutov 1045 August 26, 2016 08:36AM

[nginx] internal location keepalive_requests issue

crasyangel 437 August 27, 2016 06:10AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 230
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready