Sorry for my question, the schema like this: there are upstream which is a IIS server where locates video files. my nginx is an proxy caching server, I need to cache mp4 file when client starts playing it in his browser and send/stream it to client. if index of mp4 file locates at the beginning of file, then its ok, it works good. but if index of file locates at the end of mp4 file then I have problems I am looking up to cache and see that nginx caching from upstream file till the end and deliting it and for next section of file it caching it again fully sending section and delete cache... I do not understand why :( also it send many error headers as incorrect length in this case player stops :(

(RAM Cache definitions)

1 level server defs

server {
    listen        front.network;
     server_name   .mybox.com;

    add_header 'Access-Control-Allow-Origin' '*';
    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
    add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';

    max_ranges 1024;

    proxy_cache ssd;
    proxy_cache_valid 200 600s;
    proxy_cache_lock on;
    proxy_read_timeout 10m;
    proxy_send_timeout 10m;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    add_header Accept-Ranges bytes;
    proxy_cache_min_uses 1;
    proxy_force_ranges on;

    proxy_cache_key   $uri$is_args$args;

    # Immediately forward requests to the origin if we are filling the cache
    proxy_cache_lock_timeout 0s;

    # Set the 'age' to a value larger than the expected fill time
    proxy_cache_lock_age 200s;
    proxy_cache_valid 200 206 301 302 48h ;

    proxy_cache_use_stale updating;

    location /5 {
        proxy_set_header Host $redirect_host;
        proxy_pass http://$redirect_upstream;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.