Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: range requests aren't working #5356

Open
5 tasks done
aeharding opened this issue Jan 24, 2025 · 3 comments
Open
5 tasks done

[Bug]: range requests aren't working #5356

aeharding opened this issue Jan 24, 2025 · 3 comments
Labels
area: media bug Something isn't working

Comments

@aeharding
Copy link

Requirements

  • Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support
  • Did you check to see if this issue already exists?
  • Is this only a single bug? Do not put multiple bugs in one issue.
  • Do you agree to follow the rules in our Code of Conduct?
  • Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.

Summary

Pict-rs range requests aren't working. This is needed for video streaming.

Safari in particular fails to playback https://lt.harding.dev/pictrs/image/88aaf722-b9d5-4e72-88c4-63e5e9a1bc42.mp4 in a video element because the server doesn't support range requests.

Steps to Reproduce

  1. Non-lemmy hosted file: curl -I -H "Range: bytes=0-1" https://pub-be81109990da4727bc7cd35aa531e6b2.r2.dev/safari-fails-to-playback.mp4
  2. Observe 206 with correct reponse header Content-Range: bytes 0-1/5975596
  3. Lemmy-pictrs-hosted file: curl -I -H "Range: bytes=0-1" https://lt.harding.dev/pictrs/image/88aaf722-b9d5-4e72-88c4-63e5e9a1bc42.mp4
  4. Observe 200 with Content-Range not present

Technical Details

lt.harding.dev is running latest ansible config.

Version

0.19.8

Lemmy Instance URL

lt.harding.dev

@aeharding aeharding added the bug Something isn't working label Jan 24, 2025
@Nutomic
Copy link
Member

Nutomic commented Jan 27, 2025

Not sure what the problem is, Lemmy does forward the entire request including headers to pictrs, and returns all response headers. Can you check if the range request is working directly against pictrs? Also note that Lemmy doesnt support head requests.

sudo docker compose exec lemmy bash
curl -v -H "Range: bytes=0-1" http://pictrs:8080/image/original?alias=88aaf722-b9d5-4e72-88c4-63e5e9a1bc42.mp4 >/dev/null

@aeharding
Copy link
Author

@Nutomic yes, here is the response:

aeharding@lt:/srv/lemmy/lt.harding.dev$ sudo docker compose exec lemmy bash
lemmy@lemmy:/$ curl -v -H "Range: bytes=0-1" http://pictrs:8080/image/original?alias=88aaf722-b9d5-4e72-88c4-63e5e9a1bc42.mp4 >/dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 172.18.0.5:8080...
* Connected to pictrs (172.18.0.5) port 8080 (#0)
> GET /image/original?alias=88aaf722-b9d5-4e72-88c4-63e5e9a1bc42.mp4 HTTP/1.1
> Host: pictrs:8080
> User-Agent: curl/7.88.1
> Accept: */*
> Range: bytes=0-1
>
< HTTP/1.1 206 Partial Content
< transfer-encoding: chunked
< cache-control: public, max-age=604800, immutable
< last-modified: Mon, 20 Jan 2025 23:31:03 GMT
< content-range: bytes 0-1/5975596
< content-type: video/mp4
< accept-ranges: bytes
< date: Mon, 27 Jan 2025 17:06:13 GMT
<
{ [12 bytes data]
100     2    0     2    0     0    234      0 --:--:-- --:--:-- --:--:--   250
* Connection #0 to host pictrs left intact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: media bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants