# HTTP Range support missing, cannot resume file download

**URL:** https://meta.discourse.org/t/http-range-support-missing-cannot-resume-file-download/235636
**Category:** Feature
**Created:** [August 9, 2022, 6:53pm UTC](https://meta.discourse.org/t/http-range-support-missing-cannot-resume-file-download/235636 "2022-08-09T18:53:12Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ValdikSS](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/valdikss/32/157221_2.png) [@ValdikSS](https://meta.discourse.org/u/ValdikSS)
#### Post date: [August 9, 2022, 6:53pm UTC](https://meta.discourse.org/t/http-range-support-missing-cannot-resume-file-download/235636/1 "2022-08-09T18:53:12Z")

</div>

Discourse is missing support for HTTP [Range header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests) and always replies with 200 OK code instead of 206 Partial Content for the file downloads. This is inconvenient for the forum users as it forces to redownload the whole file in case of unstable internet connection.

The topic [Backup too big, is there a way to download it through "resume download"](https://meta.discourse.org/t/backup-too-big-is-there-a-way-to-download-it-through-resume-download/110567) mentioned this issue in case of backup download, however this also applies to regular file download when S3 storage is not used.

I checked nginx proxy configuration, and it’s not a configuration issue. Range header is properly passed to `localhost:3000` for `/uploads/short-url/` requests, but Discourse does not handle it.

As HTTP Range is one of the basic HTTP features, filling it under “bug”, not “feature” category.

P.S. it is not reproducible here, on `meta.discourse.org`, as it uses S3 for storage.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [August 9, 2022, 8:00pm UTC](https://meta.discourse.org/t/http-range-support-missing-cannot-resume-file-download/235636/2 "2022-08-09T20:00:22Z")

</div>

> [@ValdikSS](#):
>
> Range header is properly passed to `localhost:3000` for `/uploads/short-url/` requests, but Discourse does not handle it.

That is handled here:

> <https://github.com/discourse/discourse/blob/10a1b6b0a9e07b1652e23c02f55a32b1b607e722/app/controllers/uploads_controller.rb#L287-L303>

Adding support for ranges is definitely possible, but would involve using send\_data, and reading the file from disk and sending the range:

> <https://stackoverflow.com/questions/6759426/rails-media-file-stream-accept-byte-range-request-through-send-data-or-send-file/57786143#57786143>

A bit too messy to be honest.
