0

I'm serving a some larger static files through an nginx proxy, and most clients requests these with range requests. My undrstanding is that when the request is made with a header of

Range: bytes=0-

It isn't necessary to send the whole file, but rather it can be an arbitrary size of the entire file. I've tried to find if it's possible to set a default limit in nginx on the preferred size of the response to such requests without any luck.

So I'm basically wondering if this is possible, to for example say limit the response to 10m if the client requests the file with an open ended range request?

  • 1
    Why would you want that though? – Christopher Perrin Oct 9 '18 at 11:55
  • My hope would be to distribute the connections a bit more evenly since the whole file would not be needed to start playing (it's mainly audio files) – Rossi Oct 9 '18 at 15:00
0

The ngx_http_slice module should make it possible to split the response into defined slices.

The ngx_http_slice_module module (1.9.8) is a filter that splits a request into subrequests, each returning a certain range of response.

| improve this answer | |
  • This does seem to create smaller range requests to the upstream, but it still returns the full file if I do a request with Range: bytes=0- – Rossi Oct 9 '18 at 14:58
  • I don't think there is a way to do what you want – Christopher Perrin Oct 10 '18 at 13:39

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.