# How to proxy streaming video

**URL:** <https://www.ruby-forum.com/t/how-to-proxy-streaming-video/153318>\
**Category:** Rails\
**Created:** [November 14, 2008, 7:54pm UTC](https://www.ruby-forum.com/t/how-to-proxy-streaming-video/153318 "2008-11-14T19:54:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 14, 2008, 7:54pm UTC](https://www.ruby-forum.com/t/how-to-proxy-streaming-video/153318/1 "2008-11-14T19:54:33Z")

</div>

We have a secure application on the Internet that you have to log into  
to use. We want to be able to display a video from a streaming media  
server via this application. The streaming media server is behind a  
firewall so I want my Rails app to proxy the stream to the user so  
that the stream is not available unless you log in.

I know I can use send\_file to just show the video file, but I prefer  
to be able to use the streaming server so that the user does not have  
to wait for the file to download before it starts to play.

Any suggestions would be greatly appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 15, 2008, 2:26am UTC](https://www.ruby-forum.com/t/how-to-proxy-streaming-video/153318/2 "2008-11-15T02:26:53Z")

</div>

Void wrote:

> Any suggestions would be greatly appreciated.

Hi,

If it helps, I believe most good video formats will fake streaming in a  
browser, I know flash does this ala YouTube. Also the DivX web player  
and  
quicktime do it.

HTH

Matt

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 15, 2008, 2:44am UTC](https://www.ruby-forum.com/t/how-to-proxy-streaming-video/153318/3 "2008-11-15T02:44:26Z")

</div>

Void wrote:

> We have a secure application on the Internet that you have to log into  
> to use. We want to be able to display a video from a streaming media  
> server via this application. The streaming media server is behind a  
> firewall so I want my Rails app to proxy the stream to the user so  
> that the stream is not available unless you log in.
> 
> I know I can use send\_file to just show the video file, but I prefer  
> to be able to use the streaming server so that the user does not have  
> to wait for the file to download before it starts to play.

You could do this by having the action read from a streaming  
Net::HTTP get, while writing the fragments to Rails’ output  
buffer.

Have you also looked into adding a one-time authentication  
key to URLs passed to the streaming server?

–  
Rails Wheels - Find Plugins, List & Sell Plugins -  
[http://railswheels.com](http://railswheels.com)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 15, 2008, 4:12am UTC](https://www.ruby-forum.com/t/how-to-proxy-streaming-video/153318/4 "2008-11-15T04:12:46Z")

</div>

On Nov 14, 6:43 pm, Mark Reginald J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> You could do this by having the action read from a streaming  
> Net::HTTP get, while writing the fragments to Rails’ output  
> buffer.
> 
> Have you also looked into adding a one-time authentication  
> key to URLs passed to the streaming server?
> 
> –  
> Rails Wheels - Find Plugins, List & Sell Plugins -[http://railswheels.com](http://railswheels.com)

Thanks Mark. Yes, my next step was to go with some kind of one-time  
authentication if I couldn’t do the proxying.
