Intermittent proxy_pass error - body shows headers

Hi all

First kudos to all of the maintainers of modules and the nginx team.
Great product guys!!

I am getting an intermittent error where the headers of a 302 redirect
are being shown as the body in the browser. The connect sits for a long
time and then this is show in the browser

0

HTTP/1.1 302 Moved Temporarily
Server: nginx/1.2.1
Date: Thu, 21 Jun 2012 18:09:04 GMT
Content-Length: 0
Connection: keep-alive
Keep-Alive: timeout=20
Location: https://www.myurlthatworls.com/someotherstuff?params

Ideas? config:

location /mylocation {
proxy_pass https://localhost:9191;
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;
proxy_pass_request_headers on;

                    client_max_body_size       10m;
                    client_body_buffer_size    128k;

                    proxy_connect_timeout      90;
                    proxy_send_timeout         90;
                    proxy_read_timeout         90;

                    proxy_buffer_size          4k;
                    proxy_buffers              4 32k;
                    proxy_busy_buffers_size    64k;
                    proxy_temp_file_write_size 64k;

}

Thanks

Chris

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,227783,227783#msg-227783

Also the 302 is being reported in the browser as a 200.

I have compiled nginx with debug and I am getting:

2012/06/21 19:16:48 [debug] 6674#0: *3 http proxy status 302 “302 Moved
Temporarily”
2012/06/21 19:16:48 [debug] 6674#0: *3 http proxy header: “Server:
Apache-Coyote/1.1”
2012/06/21 19:16:48 [debug] 6674#0: *3 http proxy header: “Location:
https://localhostthatworks/foo?bar=2818fe22-51f9-4c68-87e7-7e8dca210293
2012/06/21 19:16:48 [debug] 6674#0: *3 http proxy header:
“Content-Length: 0”
2012/06/21 19:16:48 [debug] 6674#0: *3 http proxy header: “Date: Thu, 21
Jun 2012 19:16:48 GMT”
2012/06/21 19:16:48 [debug] 6674#0: *3 http proxy header: “Connection:
close”
2012/06/21 19:16:48 [debug] 6674#0: *3 http proxy header done
2012/06/21 19:16:48 [debug] 6674#0: *3 HTTP/1.1 302 Moved Temporarily^M
Server: nginx/1.2.1^M
Date: Thu, 21 Jun 2012 19:16:48 GMT^M
Content-Length: 0^M
Connection: keep-alive^M
Keep-Alive: timeout=20^M
Location:
https://myurlsthatworks.com/foo?bar=2818fe22-51f9-4c68-87e7-7e8dca210293^M

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,227783,227784#msg-227784

kolbyjack on irc helped me figure this out. The preceding call did not
return any data correctly, and thus a 0\ was stuck in the buffer. Fixed
the call before the post and voila!

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,227783,227785#msg-227785