Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to set up a HTTP streaming server I wrote with Tornado and python. Basically, it keeps the connection alive and occasionally flushes information out. It's a bit like long polling, except the connection isn't broken by the server.

Is it possible to put something like this behind nginx? I'm testing it from my browser, and I can't see any output until the server breaks the connection, then it's all sent at once.

share|improve this question

2 Answers 2

up vote 4 down vote accepted

You need to turn proxy_buffering off for the streaming requests. If all requests to the backend will be streaming, you can just use http://wiki.nginx.org/HttpProxyModule#proxy_buffering . As it states in that wiki entry, you can also manage buffering on a per-request basis by having your backend include an X-Accel-Buffering header to turn buffering on or off.

share|improve this answer
    
This was it. Thank you! –  Paul Apr 26 '11 at 4:02

Just a guess. Is the tcp_nodelay to Off? It is on by default unless turned off. Nginx Documentation

share|improve this answer
    
Hm, that didn't do it. I should also mention that the Tornado app acts as expected when I access it directly, so I'm guessing nginx is doing some kind of buffering? –  Paul Apr 25 '11 at 3:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.