Thanks to Maxim, I make a mistake that do not read the r->out statements. The r->out is NULL, so something goes wrong. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,214608,214610#msg-214610