# Intermittent proxy\_pass error - body shows headers

**URL:** <https://www.ruby-forum.com/t/intermittent-proxy-pass-error-body-shows-headers/220838>\
**Category:** NGINX\
**Created:** [June 21, 2012, 8:20pm UTC](https://www.ruby-forum.com/t/intermittent-proxy-pass-error-body-shows-headers/220838 "2012-06-21T20:20:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [June 21, 2012, 8:20pm UTC](https://www.ruby-forum.com/t/intermittent-proxy-pass-error-body-shows-headers/220838/1 "2012-06-21T20:20:09Z")

</div>

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](https://www.myurlthatworls.com/someotherstuff?params)

Ideas? config:

location /mylocation {  
proxy\_pass [https://localhost:9191](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:

> **[intermittent proxy\_pass error - body shows headers](https://forum.nginx.org/read.php?2,227783,227783#msg-227783)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![chrislovecnm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e8c25b/32.png) [@chrislovecnm](https://www.ruby-forum.com/u/chrislovecnm)\
**Post date:** [June 21, 2012, 9:26pm UTC](https://www.ruby-forum.com/t/intermittent-proxy-pass-error-body-shows-headers/220838/2 "2012-06-21T21:26:10Z")

</div>

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](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](https://myurlsthatworks.com/foo?bar=2818fe22-51f9-4c68-87e7-7e8dca210293%5EM)

Posted at Nginx Forum:

> **[Re: intermittent proxy\_pass error - body shows headers](https://forum.nginx.org/read.php?2,227783,227784#msg-227784)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![chrislovecnm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e8c25b/32.png) [@chrislovecnm](https://www.ruby-forum.com/u/chrislovecnm)\
**Post date:** [June 21, 2012, 9:59pm UTC](https://www.ruby-forum.com/t/intermittent-proxy-pass-error-body-shows-headers/220838/3 "2012-06-21T21:59:28Z")

</div>

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:

> **[Re: intermittent proxy\_pass error - body shows headers](https://forum.nginx.org/read.php?2,227783,227785#msg-227785)**
>
> 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...
