# Rtsp over http response blocked by nginx

**URL:** <https://www.ruby-forum.com/t/rtsp-over-http-response-blocked-by-nginx/216271>\
**Category:** NGINX\
**Created:** [January 31, 2012, 2:24pm UTC](https://www.ruby-forum.com/t/rtsp-over-http-response-blocked-by-nginx/216271 "2012-01-31T14:24:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 31, 2012, 2:24pm UTC](https://www.ruby-forum.com/t/rtsp-over-http-response-blocked-by-nginx/216271/1 "2012-01-31T14:24:50Z")

</div>

Hello

I am trying to use NGINX as reverse proxy for streaming using QuickTime  
and rtsp over http.  
QuicKTime send an http GET to my reverse proxy in a public zone, then my  
reverse proxy send the request to my video server in a private zone.  
What I can see is that the http GET request is received by NGINX on the  
reverse proxy, then by my video server, which responds immediately with  
a 200 OK.  
This response is received by the reverse proxy, but it seems that NGINX  
block the response. (see log file attached).

Other http traffic is executed without any problem, problems occurs only  
with rtsp over http.

The http headers of the http GET send by QuickTime are:  
User-Agent: QuickTime/7.7 (qtver=7.7;os=Windows NT 5.1Service Pack 3)  
x-sessioncookie: 4qqv28gOAABf4EQBBoAAAA  
Accept: application/x-rtsp-tunnelled  
Pragma: no-cache  
Cache-Control: no-cache

Here is my NGINX configuration:

------- /etc/nginx/nginx.conf BEGIN -------  
worker\_processes 1;  
error\_log /var/log/nginx/error.log ;

pid /var/run/nginx/nginx.pid;

events {  
worker\_connections 1024;  
}

http {  
include mime.types;  
default\_type application/octet-stream;  
access\_log /var/log/nginx/access.log;  
sendfile on;

```
keepalive_timeout 65;

gzip on;
#gzip off;
gzip_min_length 1000;
#gzip_buffers 4 8k;
#gzip_http_version 1.0;
gzip_comp_level 3;
gzip_proxied any;
#gzip_types text/plain application/xml;
gzip_types text/plain text/css application/json

```

application/x-javascript text/xml application/xml application/xml+rss  
text/javascript;  
gzip\_vary on;

include /etc/nginx/sites-enabled/\*;  
include /etc/nginx/proxy.conf;  
}  
------- /etc/nginx/nginx.conf END -------

------- /etc/nginx/proxy.conf BEGIN -------  
proxy\_redirect off;  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
client\_max\_body\_size 10m;  
client\_body\_buffer\_size 128k;  
proxy\_connect\_timeout 90;  
proxy\_send\_timeout 90;  
proxy\_read\_timeout 90;  
proxy\_buffers 32 4k;  
------- /etc/nginx/proxy.conf END -------

------- /etc/nginx/sites-enabled/video.conf BEGIN -------  
upstream video  
{  
server 10.194.188.2:80;  
}  
server  
{  
listen 10.194.188.90:80;  
server\_name ;  
location /  
{  
proxy\_pass [http://video](http://video);  
}  
error\_log /var/log/nginx/errori debug;  
}  
------- /etc/nginx/sites-enabled/video.conf END -------

Thank’s for your help…

Eric

---

<div class="post-metadata">

**Author:** ![likumahuwa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/d9b06d/32.png) [@likumahuwa](https://www.ruby-forum.com/u/likumahuwa)\
**Post date:** [February 1, 2012, 1:04am UTC](https://www.ruby-forum.com/t/rtsp-over-http-response-blocked-by-nginx/216271/2 "2012-02-01T01:04:49Z")

</div>

Hello!

On Tue, Jan 31, 2012 at 02:24:50PM +0100, eric elg wrote:

> block the response. (see log file attached).  
> The log provided suggests that backend neither close connection  
> nor send anything. I suspect it’s waiting for another request  
> from the client before sending additional data, but didn’t get it  
> due to buffering in nginx. You may try adding

```
proxy_buffering off;

```

to see if it helps.

On the other hand, the following link:

[http://developer.apple.com/quicktime/icefloe/dispatch028.html](http://developer.apple.com/quicktime/icefloe/dispatch028.html)

suggests that rtsp over http uses POST requests with some  
arbitrary large Content-Length. It’s likely to be next problem  
you’ll encounter. And this is not going to work through nginx.

Maxim D.

---

<div class="post-metadata">

**Author:** ![likumahuwa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/d9b06d/32.png) [@likumahuwa](https://www.ruby-forum.com/u/likumahuwa)\
**Post date:** [February 1, 2012, 2:23am UTC](https://www.ruby-forum.com/t/rtsp-over-http-response-blocked-by-nginx/216271/3 "2012-02-01T02:23:54Z")

</div>

Hello!

On Wed, Feb 01, 2012 at 04:04:24AM +0400, Maxim D. wrote:

> > What I can see is that the http GET request is received by NGINX on the  
> > proxy\_buffering off;
> 
> to see if it helps.
> 
> On the other hand, the following link:
> 
> [http://developer.apple.com/quicktime/icefloe/dispatch028.html](http://developer.apple.com/quicktime/icefloe/dispatch028.html)
> 
> suggests that rtsp over http uses POST requests with some  
> arbitrary large Content-Length. It’s likely to be next problem  
> you’ll encounter. And this is not going to work through nginx.

Hm, the

[https://helixcommunity.org/viewcvs/protocol/common/util/hxcloakedsocket.cpp?view=markup](https://helixcommunity.org/viewcvs/protocol/common/util/hxcloakedsocket.cpp?view=markup)

claims it should switch to “multi-post mode” then, so it looks  
like I was wrong and rtsp over http will actually work.

So the only real problem is response buffering in nginx, which may  
be easily swithed off (see above).

Maxim D.

---

<div class="post-metadata">

**Author:** ![likumahuwa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/d9b06d/32.png) [@likumahuwa](https://www.ruby-forum.com/u/likumahuwa)\
**Post date:** [February 2, 2012, 3:33pm UTC](https://www.ruby-forum.com/t/rtsp-over-http-response-blocked-by-nginx/216271/4 "2012-02-02T15:33:15Z")

</div>

Hello,

Thank’s for your reply!  
Switching off the buffering as suggested allow to get the response of  
http GET, but as you said, POST requests have got an arbitrary large  
Content-Length and does not work through nginx.

I have now to update my video server to be compliant with the multi-post  
mode.

Eric
