max_ranges has no effect

classic Classic list List threaded Threaded
4 messages Options
xrd
Reply | Threaded
Open this post in threaded view
|

max_ranges has no effect

xrd
Hello,
I want to disable resumable downloads.
Added max_ranges directive:


    location ~ ^(/[^/]+/[^/]+/[^/]+) {
        set $zone_limit_key $binary_remote_addr$host;
        limit_req zone=req_free burst=10 nodelay;
        limit_conn conn_free 1;
        max_ranges 0;
        rewrite ^/([^/]+)/([^/]+)/([^/]+)$
/v1/AUTH_system/$1/$2/$3?type=free break;
        keepalive_requests 0;
        proxy_pass       <a href="http://10.10.100.110:8080;">http://10.10.100.110:8080;
        proxy_set_header Host      $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_intercept_errors on;
    }

But it has no effect

hett@hett-pc: $ curl -v -r 100-102 "https://......." 2>&1 > /dev/null | grep
"<"
< HTTP/1.1 206 Partial Content
< Server: nginx
< Date: Mon, 14 Oct 2019 06:41:13 GMT
< Content-Type: application/octet-stream
< Content-Length: 3
< Connection: close
< Accept-Ranges: bytes
< Last-Modified: Tue, 20 Aug 2019 12:16:22 GMT
< Content-Range: bytes 100-102/466391882

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,285861,285861#msg-285861

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: max_ranges has no effect

Sergey Kandaurov

> On 14 Oct 2019, at 09:56, Hett <[hidden email]> wrote:
>
> Hello,
> I want to disable resumable downloads.
> Added max_ranges directive:
>
>
>    location ~ ^(/[^/]+/[^/]+/[^/]+) {
>        set $zone_limit_key $binary_remote_addr$host;
>        limit_req zone=req_free burst=10 nodelay;
>        limit_conn conn_free 1;
>        max_ranges 0;
>        rewrite ^/([^/]+)/([^/]+)/([^/]+)$
> /v1/AUTH_system/$1/$2/$3?type=free break;
>        keepalive_requests 0;
>        proxy_pass       <a href="http://10.10.100.110:8080;">http://10.10.100.110:8080;
>        proxy_set_header Host      $host;
>        proxy_set_header X-Real-IP $remote_addr;
>        proxy_set_header X-Forwarded-For $remote_addr;
>        proxy_intercept_errors on;
>    }
>
> But it has no effect

This is because the range request is processed by the proxied server,
and then nginx has nothing to do with the response.
Instead, you may want to disable range processing on backend,
by removing the Range request header while proxying requests:

proxy_set_header Range "";

--
Sergey Kandaurov

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
xrd
Reply | Threaded
Open this post in threaded view
|

Re: max_ranges has no effect

xrd
Thanks, I thought so,
and I thought nginx will delete this header via `max_ranges` directive.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,285861,285875#msg-285875

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
xrd
Reply | Threaded
Open this post in threaded view
|

Re: max_ranges has no effect

xrd
Next headers resolve my issue

        proxy_set_header Range "";
        proxy_hide_header Accept-Ranges;
        add_header Accept-Ranges none;

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,285861,285876#msg-285876

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx