nginx reverse proxy send output before connection close

clarkk asked:

I have setup a reverse proxy with nginx to webmin.. But it looks like nginx doesn’t sends the HTTP response before after the connection has closed?!

If a long request (cronjob) is requested the output will first be received by the end user after the request has ended? How to setup nginx so the reponse is sent as soon as the first byte is sent back to the proxy (nginx)?

location / {
    proxy_pass  https://xx.xx.xx.xx:10000/;
}

My answer:


You could just turn off proxy_buffering.

location / {
    proxy_buffering off;
    proxy_pass  https://xx.xx.xx.xx:10000/;
}

Be aware that buffering is a performance optimization that usually works best when enabled; if disabling it causes you problems overall, you may wish to disable it only for specific locations (by creating a new location block).


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.