nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.27k stars 323 forks source link

Add HTTP Range header support #1011

Open dj1471 opened 7 months ago

dj1471 commented 7 months ago

Please add support for the HTTP Range header when serving static files, such that a range of bytes can be requested.

Ref RFC 9110: https://datatracker.ietf.org/doc/html/rfc9110#name-range-requests

This allows interrupted downloads to be resumed and allows seeking of media files.

tippexs commented 7 months ago

Hi @dj1471 this is currenlty not planed as this would require some medium changes to the Unit Router to handle this. Are we talking about files shared using share from Unit directly? In case of applications (PHP, Python, Node) this can be achieved through the application code.

I know - this is FAR AWAY from beeing ideal but I have added something like this using a nodebased express middleware using res.download.

See the test implementation here: https://github.com/expressjs/express/blob/2a00da2067b7017f769c9100205a2a5f267a884b/test/res.download.js#L34C56-L34C57

Let me know if this would help you for now AND I will check in with the team whats needed to add support for accepting ranges.