jules27
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2011
02:10 PM
Problem with HTTP redirect 302 and HLS
I am testing out Roku2's capability to play HLS streams served by Wowza. I have found no problems playing static content and live streams. However, I did run into a problem with an in-house feature involving HTTP redirects that I'm hoping someone from Roku can give some pointers.
We have a feature that has user-agent detection and redirects from a generic URL to a protocol-specific URL depending on the user-agent. For example, given a generic URL "http://<domain>.com/path/to/file.mp4", and a user-agent "roku", we will perform an HTTP redirect to "http://<domain>.com/path/to/file.mp4/playlist.m3u8".
This is the sequence of events I got from tcpdump on the Roku2.
1. Roku2 does a GET on the generic URL. It receives a "HTTP/1.1 302 Found" for the correct URL that points to playlist.m3u8.
2. Roku2 does a GET on the URL "http://<domain>.com/path/to/file.mp4/playlist.m3u8". It receives a "HTTP/1.1 200 OK" and the following playlist.m3u8 file from Wowza:
3. This is where things go wrong. Roku2 does a GET on the generic URL again and somehow strips out the filename: "http://<domain>.com/path/to/playlist.m3u8?wowzasessionid=12345678" and receives a "HTTP/1.1 302 Found" for the incorrect URL, also without a filename, and with a duplicate playlist.m3u8: "http://<domain>.com/path/to/playlist.m3u8/playlist.meu8?wowzasessionid=12345678".
4. Roku2 does a GET on the incorrect URL and receives a "HTTP/1.1 403 Forbidden", and the session ends.
For this test, I took the example "simplevideoplayer" from the SDK and hardcoded URL's in. My Roku2 is running 4.1 build 1275.
Is Roku's behavior in step 3 expected?
We have a feature that has user-agent detection and redirects from a generic URL to a protocol-specific URL depending on the user-agent. For example, given a generic URL "http://<domain>.com/path/to/file.mp4", and a user-agent "roku", we will perform an HTTP redirect to "http://<domain>.com/path/to/file.mp4/playlist.m3u8".
This is the sequence of events I got from tcpdump on the Roku2.
1. Roku2 does a GET on the generic URL. It receives a "HTTP/1.1 302 Found" for the correct URL that points to playlist.m3u8.
2. Roku2 does a GET on the URL "http://<domain>.com/path/to/file.mp4/playlist.m3u8". It receives a "HTTP/1.1 200 OK" and the following playlist.m3u8 file from Wowza:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=672450
playlist.m3u8?wowzasessionid=12345678
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=64000
playlist.m3u8?wowzaaudioonly&wowzasession
3. This is where things go wrong. Roku2 does a GET on the generic URL again and somehow strips out the filename: "http://<domain>.com/path/to/playlist.m3u8?wowzasessionid=12345678" and receives a "HTTP/1.1 302 Found" for the incorrect URL, also without a filename, and with a duplicate playlist.m3u8: "http://<domain>.com/path/to/playlist.m3u8/playlist.meu8?wowzasessionid=12345678".
4. Roku2 does a GET on the incorrect URL and receives a "HTTP/1.1 403 Forbidden", and the session ends.
For this test, I took the example "simplevideoplayer" from the SDK and hardcoded URL's in. My Roku2 is running 4.1 build 1275.
Is Roku's behavior in step 3 expected?
12 REPLIES 12

RokuKevin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2011
03:52 PM
Re: Problem with HTTP redirect 302 and HLS
Jules27,
If you send me a private message with the top level url, I will take a look at it.
--Kevin
If you send me a private message with the top level url, I will take a look at it.
--Kevin
jules27
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2011
02:36 PM
Re: Problem with HTTP redirect 302 and HLS
Kevin,
I sent you some links last Tuesday. Do you have any updates with regards to Roku's behavior?
Thanks.
I sent you some links last Tuesday. Do you have any updates with regards to Roku's behavior?
Thanks.
jaycharles
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2011
05:10 AM
Re: Problem with HTTP redirect 302 and HLS
Was an answer to this question ever provided? We're planning on deploying a load balancing system that uses 302 redirects, and it would be helpful to know if this will break playback on Roku.
jules27
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2011
02:08 PM
Re: Problem with HTTP redirect 302 and HLS
No, the answer to this question has not been provided.
jaycharles
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2011
11:27 AM
Re: Problem with HTTP redirect 302 and HLS
FWIW, I just deployed a test app to see what my result would be. 302 redirection seems to be working fine for me against Roku 4.1
jules27
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2011
12:19 PM
Re: Problem with HTTP redirect 302 and HLS
Yes, I don't think Roku has problems handling 302 redirections. I have a very specific case of strange data alterations between our server and Roku that I was able to capture via tcpdump. I already sent the capture to someone and am hoping they'd get back to me with findings.
EdNewman
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2012
06:13 PM
Re: Problem with HTTP redirect 302 and HLS
I've been struggling trying I get a channel working on Roku. The stream works fine on my test hls player but not on the roku 2. I've been debugging and found the same redirect and 403 error. Did anyone ever come up with a resolution on this?
gaurachit
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2014
08:10 AM
Re: Problem with HTTP redirect 302 and HLS
I am trying to call an API in ROKU player using bright script. But I a getting "response code -3". But when I am hitting that service on Web Browser it gives the xml in response. Actually there is a redirection in the API which I am using. As I know the redirection is not handled by the ROKU OS level. So How will I come out this situation. Please help me and provide me any solution for that, how can I handle the redirection in ROKU?
Thanks in advance.
Thanks in advance.

RokuJoel
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2014
04:17 PM
Re: Problem with HTTP redirect 302 and HLS
See if the NWM_ResolveRedirect function in the urlUtils.brs file in your Roku SDK helps. You can find it in the common folder of the mrsstemplate example.
- Joel
- Joel