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

Handling of redirects of HLS segment manifest #7915

Closed
sobbe81 opened this issue Jan 21, 2025 · 8 comments
Closed

Handling of redirects of HLS segment manifest #7915

sobbe81 opened this issue Jan 21, 2025 · 8 comments
Labels
status: working as intended The behavior is intended; this is not a bug type: question A question from the community

Comments

@sobbe81
Copy link

sobbe81 commented Jan 21, 2025

Hi,

We have a setup with a component that routes traffic to different servers.

We have a main HLS manifest
https://router/foo.m3u8

That is redirected to
https://server/foo.m3u8

The main manifest contains urls to segment-manifests for example:

https://router/index.m3u8

Ant this is also redirected a server

https://server/index.m3u8

Our router component returns a 302 Found as response and Shaka directs correctly. However, when the segment manifest needs to be updated Shaka is requesting the redirected url (https://server/index.m3u8) instead of the original url (https://router/index.m3u8).

Is this expected behaviour? I would argue that the 302 Found should be interpreted as a temporary redirect and if that asset is requested again the originally url should be used. The behaviour now is more inline with the 301 Moved Permanently response.

What do you think?

@sobbe81 sobbe81 added the type: question A question from the community label Jan 21, 2025
@avelad
Copy link
Member

avelad commented Jan 24, 2025

@sobbe81 I think it's a bug in our HLS parser, if you have a test stream I can work on fixing it.

**What are the manifest and license server URIs?**
<!-- NOTE:
  You can send the URIs to <[email protected]> instead,
  but please use GitHub and the template for the rest.
  A copy of the manifest text or an attached manifest will **not** be
  enough to reproduce your issue, and we **will** ask you to send a
  URI instead.  You can copy the URI of the demo app to send us the
  exact asset, licence server, and settings you have selected there.
  Avoid geo-blocked content if at all possible, as the contributors who diagnose
  Shaka Player issues may not be able to access it.
  If you send the URIs to email, the response time and resolution
  will be much higher.
-->

@avelad avelad added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jan 24, 2025
@sobbe81
Copy link
Author

sobbe81 commented Jan 27, 2025

Hi,

ok, I sent test stream to [email protected]

@avelad
Copy link
Member

avelad commented Jan 27, 2025

Received, I'll be working on this throughout the day to see if my fix fixes your stream.

@shaka-bot shaka-bot removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jan 27, 2025
@avelad
Copy link
Member

avelad commented Jan 27, 2025

Your media playlists include segment URLs that are absolute. That's why these redirects occur. So the player is working correctly.

@avelad avelad added status: working as intended The behavior is intended; this is not a bug status: waiting on response Waiting on a response from the reporter(s) of the issue labels Jan 27, 2025
@sobbe81
Copy link
Author

sobbe81 commented Jan 27, 2025

Hi,

Could you elaborate a bit on why absolute urls matter in this case. Based on HTTP protocol or HLS spec?

The player get this url https://router/index.m3u8 to an asset and it's redirected to https://server/index.m3u8. Then the asset should be requested again. Since the redirect was temporary I would argue that https://router/index.m3u8 should be requested.

Or am I missing something?

@avelad
Copy link
Member

avelad commented Jan 27, 2025

@avelad
Copy link
Member

avelad commented Jan 27, 2025

Ok I read it wrong, sorry!

@avelad
Copy link
Member

avelad commented Jan 27, 2025

Yes, we treat all redirects internally as a 301(it doesn't matter what type of redirect it is, we only look at the uri), but in our model, internally what we have is an array of uris. So we would have [redirect, original]. If the redirect fails for any reason, we have a fallback to the original and would automatically request the original.

@shaka-bot shaka-bot removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jan 27, 2025
@avelad avelad added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jan 27, 2025
@avelad avelad closed this as completed Jan 28, 2025
@shaka-bot shaka-bot removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: working as intended The behavior is intended; this is not a bug type: question A question from the community
Projects
None yet
Development

No branches or pull requests

4 participants
@avelad @shaka-bot @sobbe81 and others