# Reverse proxy for streaming live video

**URL:** <https://www.ruby-forum.com/t/reverse-proxy-for-streaming-live-video/193675>\
**Category:** NGINX\
**Created:** [August 21, 2010, 7:38pm UTC](https://www.ruby-forum.com/t/reverse-proxy-for-streaming-live-video/193675 "2010-08-21T19:38:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fedel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/7ba0ec/32.png) [@fedel](https://www.ruby-forum.com/u/fedel)\
**Post date:** [August 21, 2010, 7:38pm UTC](https://www.ruby-forum.com/t/reverse-proxy-for-streaming-live-video/193675/1 "2010-08-21T19:38:51Z")

</div>

I am having trouble streaming HTTP tunneled video through nginx reverse  
proxy. My frontend server is running nginx 0.7.67 and a backend server  
sources a live video feed (RTSP wrapped in HTTP, mime  
application/x-rtsp-tunneled).

This is the video tag in the webpage:

```auto

```

The quicktime browser plugin requests redirect.mov from the streaming  
server. Then the streaming server and the browser plugin use an HTTP  
tunnel for wrapping the actual RTSP stream (…/path/stream).

I can access the video stream fine using any web browser if I get it  
directly from the backend. However, behind nginx reverse proxy, the  
stream won’t play. Here’s my nginx configuration:

```auto
server {
    listen 80;
    server_name frontend;
    location / {
        proxy_pass http://backend;
        proxy_redirect off;
        proxy_buffering off;
        proxy_set_header Host $host;
    }
}
```

Nginx starts loading [http://backend/path/stream](http://backend/path/stream) when the client requests  
[http://frontend/path/stream](http://frontend/path/stream). However, it stops shortly thereafter.

The quicktime user agent sends a POST request for the stream URL with  
content-length set to 32767. This request only comes with 280 or so  
bytes of body data. I guess the UA claims a huge content-length just to  
keep the pipe open. Now, nginx waits on the client connection for the  
remaining 32500 bytes, i.e. it does not forward the first 280 bytes to  
the backend streaming server which would have responded and triggered  
more data from the client but since the client won’t receive a response  
to its first 280 bytes of “in-band” request the quicktime user agent  
times out and shuts down the connection. End of stream…

Is it possible to “magically” configure nginx to transparently forward  
request data and response data immediately when they arrive?

Posted at Nginx Forum:

> **[Reverse proxy for streaming live video](https://forum.nginx.org/read.php?2,122149,122149#msg-122149)**
>
> I am having trouble streaming HTTP tunneled video through nginx reverse proxy. My frontend server is running nginx 0.7.67 and a backend server sources a live video feed (RTSP wrapped in HTTP, mime application/x-rtsp-tunneled). This is the video tag...

---

<div class="post-metadata">

**Author:** ![fedel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/7ba0ec/32.png) [@fedel](https://www.ruby-forum.com/u/fedel)\
**Post date:** [August 22, 2010, 11:39am UTC](https://www.ruby-forum.com/t/reverse-proxy-for-streaming-live-video/193675/2 "2010-08-22T11:39:48Z")

</div>

Hello!

On Sat, Aug 21, 2010 at 01:38:05PM -0400, fedel wrote:

> I am having trouble streaming HTTP tunneled video through nginx reverse  
> proxy. My frontend server is running nginx 0.7.67 and a backend server  
> sources a live video feed (RTSP wrapped in HTTP, mime  
> application/x-rtsp-tunneled).

[…]

> Is it possible to “magically” configure nginx to transparently forward  
> request data and response data immediately when they arrive?

No, it’s not possible. Requests with content-length set to  
something bigger than actual amount of data has no chances to pass  
though nginx.

Maxim D.
