<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello,<div class=""><br class=""></div><div class="">I am making a byte range request to NGINX using wget. NGINX responds with status code 206 (partial content), but instead of downloading the content, wget retries.</div><div class=""><br class=""></div><div class="">Request:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">wget -S '<a href="http://cache.example.com/video5.ts" class="">http://cache.example.com/video5.ts</a>' --header="Range: bytes=0-1023"</span></div></div><div class=""><br class=""></div><div class="">Output from wget:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">--2019-08-02 15:36:44--  <a href="http://cache.example.com/video5.ts" class="">http://cache.example.com/video5.ts</a></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Resolving <a href="http://cache.example.com" class="">cache.example.com</a> (<a href="http://cache.example.com" class="">cache.example.com</a>)... 172.16.200.5</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Connecting to <a href="http://cache.example.com" class="">cache.example.com</a> (<a href="http://cache.example.com" class="">cache.example.com</a>)|172.16.200.5|:80... connected.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">HTTP request sent, awaiting response... </span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  HTTP/1.1 206 Partial Content</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  Server: nginx/1.17.0a</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  Date: Fri, 02 Aug 2019 22:36:45 GMT</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  Content-Type: video/MP2T</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  Content-Length: 1024</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  Connection: keep-alive</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class="">  X-Server-IP: 172.16.200.5</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  Access-Control-Allow-Origin: *</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  Access-Control-Allow-Headers: Range</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  Access-Control-Allow-Methods: GET</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  Timing-Allow-Origin: *</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  Access-Control-Max-Age: 86400</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  Access-Control-Expose-Headers: X-Server-IP,Location</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  Age: 86555</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class="">  Content-Range: bytes 0-1023/135090032</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Retrying.</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">Then wget sends the request again, with the same result.</div><div class=""><br class=""></div><div class="">The same wget request to the origin succeeds. The data is cached properly (wget without the range header succeeds).</div><div class=""><br class=""></div><div class="">Adding â€”debug to the wget provides not much more.</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Registered socket 3 for persistent reuse.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Disabling further reuse of socket 3.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Closed fd 3</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Retrying.</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">There is nothing in the NGINX error log.</div><div class=""><br class=""></div><div class="">I am speculating that NGINX closes the connection before the data is delivered. But why?</div><div class=""><br class=""></div><div class="">Thanks…</div><div class=""><br class=""></div><div class="">Roger</div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>