Entire content is cached but when client pulls a byte range the entire file is sent

Wilson, Todd todd.wilson at twcable.com
Thu Mar 3 18:54:51 UTC 2016

Can the client pull a subset of the content from the cached content?

If it can pull a subset of the content via byte range requests can you point me to how to configure nginx to allow this...?

This is what is stored in cache on the nginx server.

[root at gemini-sled1 ac]# strings 81f71da53616b454815b570216041ac7 | more
KEY: GET/atis/vod/0x1051e69a101e9/d4_HDFD0075260002446163-8320285.mpg
HTTP/1.1 206 Partial Content
Server: Cisco/CDS Gateway/3.0
Connection: close
Content-Type: video/mpeg
Content-Length: 597600300
Content-Range: bytes 0-597600299/597600300
Cache-Control: public

But when the client attempt to pull a byte range the entire file is pulled.

curl -v -o /dev/null -r 1000-1001
* About to connect() to port 80
*   Trying connected
* Connected to ( port 80
> GET /atis/vod/0x1051e69a101e9/d4_HDFD0075260002446163-8320285.mpg HTTP/1.1
> Range: bytes=1000-1001
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host:
> Accept: */*
< HTTP/1.1 206 Partial Content
< Server: nginx/1.9.9
< Date: Thu, 03 Mar 2016 18:36:05 GMT
< Content-Type: video/mpeg
< Content-Length: 597600300
< Connection: keep-alive
< Content-Range: bytes 0-597600299/597600300
< Cache-Control: public
< Link: <http://atisdemo.atge.twcable.com/atis/vod/d4_HDFD0075260002446163-8320285.mpg.mrm>; rel="http://www.iif.atis.com/c2-media-resource-metadata"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  569M  100  569M    0     0  3758k      0  0:02:35  0:02:35 --:--:-- 4054k

We have nginx version 1.9.9 installed.


user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" "$uri" "$request_uri" "$request_completion" "$cookie_session" "$http_cookie" "$http_host" "$host" "$server_port"  "$proxy_add_x_forwarded_for" ';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    tcp_nopush     on;
    tcp_nodelay on;

    #keepalive_timeout  65;

    proxy_http_version 1.1;
    proxy_cache_methods GET  HEAD  POST;
    proxy_pass_request_headers on;
    fastcgi_buffers 8 160k;
    fastcgi_buffer_size 320k;
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;

    #proxy_cache_path /arroyo/nginxtest/sample/atis/vod levels=1:2 keys_zone=my-cache:80m
    proxy_cache_path /cache1 levels=1:2 keys_zone=my-cache:80m max_size=2g inactive=6000m use_temp_path=off;
    #proxy_temp_path /var/cache/tmp;

    proxy_force_ranges on;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_cache_key "$request_method$request_uri";

    proxy_cache my-cache;
    proxy_cache_valid 200 206 1d;
    proxy_cache_valid 404 1m;

    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;

    proxy_headers_hash_max_size 51200;
    proxy_headers_hash_bucket_size 6400;

    include /etc/nginx/conf.d/*.conf;



#resolve these upstream servers in /etc/hosts
upstream server_array {

server {
    listen;                  #local ip:port for nginx to listen
    server_name atisdemo.atge.twcable.com;
    max_ranges 4;
    proxy_force_ranges on;
    location / {
       limit_rate_after 10k;
       set $limit_rate 3750k;
       proxy_intercept_errors on;
       proxy_pass http://server_array;
       error_page 302 = @locationupstream;
location @locationupstream{
    rewrite_log on;
    set $limit_rate 3750k;
    set $upstreamlocation '$upstream_http_location';
    proxy_set_header Range $http_range;
    proxy_set_header "User-Agent" "Cisco/CDS Gateway/3.0";
    proxy_pass_header Server;
    proxy_pass $upstreamlocation;
    proxy_force_ranges on;

Todd Wilson


This E-mail and any of its attachments may contain Time Warner Cable proprietary information, which is privileged, confidential, or subject to copyright belonging to Time Warner Cable. This E-mail is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient of this E-mail, you are hereby notified that any dissemination, distribution, copying, or action taken in relation to the contents of and attachments to this E-mail is strictly prohibited and may be unlawful. If you have received this E-mail in error, please notify the sender immediately and permanently delete the original and any copy of this E-mail and any printout.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160303/3aed37a3/attachment.html>

More information about the nginx mailing list