<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">location /hls { </span><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">error_page 404 = @hls; </span><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">keepalive_requests 1000; </span><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">} </span><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">location @hls { </span><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class=""># Serve HLS fragments </span><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">types { </span><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">application/vnd.apple.mpegurl m3u8; </span><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">video/mp2t ts; </span><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">} </span><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">root /tmp; </span><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">add_header Cache-Control no-cache; </span><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">keepalive_requests 1000; </span><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">} </span><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">keepalive_requests must be large enough in this two location meanwhile </span><br style="clear: both; font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2;" class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class="">if set keepalive_requests to 0 or 1 in /hls, keepalive_requests would not work in @hls</span><div class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class=""><br class=""></span></div><div class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">if (r->keepalive) { </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">if (clcf->keepalive_timeout == 0) { </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">r->keepalive = 0; </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">} else if (r->connection->requests >= clcf->keepalive_requests) { </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">r->keepalive = 0; </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">} else if (r->headers_in.msie6 </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">&& r->method == NGX_HTTP_POST </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">&& (clcf->keepalive_disable </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">& NGX_HTTP_KEEPALIVE_DISABLE_MSIE6)) </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">{ </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">/* </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">* MSIE may wait for some time if an response for </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">* a POST request was sent over a keepalive connection </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">*/ </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">r->keepalive = 0; </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">} else if (r->headers_in.safari </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">&& (clcf->keepalive_disable </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">& NGX_HTTP_KEEPALIVE_DISABLE_SAFARI)) </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">{ </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">/* </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">* Safari may send a POST request to a closed keepalive </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">* connection and may stall for some time, see </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">* <a href="https://bugs.webkit.org/show_bug.cgi?id=5760" class="">https://bugs.webkit.org/show_bug.cgi?id=5760</a> </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">*/ </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">r->keepalive = 0; </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">} </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">} </span><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">Note r->keepalive only effect that Connection filed in response header and set keepalive timer when finalize request. </span></span></div><div class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class=""><br class=""></span></span></div><div class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">Why place this code block in ngx_http_update_location_config? Would be better place it where set keepalive timer? </span></span></div><div class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class=""><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">And sometimes nginx would send "Connection: keep-alive", but close connection in 1.10.1 version, and this would be nothing seriously</span></span></div><div class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class=""><br style="clear: both; font-variant-ligatures: normal; line-height: normal;" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class="">So why is it the expected behaviour?</span></span></div><div class=""><span style="font-family: Arial; font-size: medium; font-variant-ligatures: normal; line-height: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: normal; line-height: normal;" class=""><br class=""></span></span></div></body></html>