# Why two different responses?

**URL:** <https://www.ruby-forum.com/t/why-two-different-responses/223997>\
**Category:** NGINX\
**Created:** [October 26, 2012, 5:05am UTC](https://www.ruby-forum.com/t/why-two-different-responses/223997 "2012-10-26T05:05:17Z")\
**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:** [October 26, 2012, 5:05am UTC](https://www.ruby-forum.com/t/why-two-different-responses/223997/1 "2012-10-26T05:05:17Z")

</div>

One of these requests is sent by my program. One is sent by curl (it’s  
easy to tell which). They are identical as far as I can tell.  
However, the curl request returns the expected result (204) from my  
servlet. The program keeps getting this 302 returned with some generic  
“302 Found” html from nginx.

My eyes are blurry from staring at it. Can anyone tell me why my test  
with curl works, but the program sending the same request does not???

Thanks,  
AJ

xx.yy.zz.64 - - [26/Oct/2012:02:49:38 +0000] “GET  
/myCoordinator/Coordinator?Action=servers HTTP/1.1”  
upstream\_cache\_status - 302 171 “-” “-” “-”

tt.ss.kk.134 - - [26/Oct/2012:02:52:43 +0000] “GET  
/myCoordinator/Coordinator?Action=servers HTTP/1.1”  
upstream\_cache\_status MISS 204 0 “-” “curl/7.19.7  
(x86\_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.1.0 zlib/1.2.3  
libidn/1.18 libssh2/1.2.2” “-”

---

<div class="post-metadata">

**Author:** ![AJ\_Weber](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8c91f0/32.png) [@AJ\_Weber](https://www.ruby-forum.com/u/AJ_Weber)\
**Post date:** [October 26, 2012, 10:13am UTC](https://www.ruby-forum.com/t/why-two-different-responses/223997/2 "2012-10-26T10:13:08Z")

</div>

On Thu, Oct 25, 2012 at 11:03:57PM -0400, AJ Weber wrote:

Hi there,

> One of these requests is sent by my program. One is sent by curl (it’s  
> easy to tell which). They are identical as far as I can tell.

What is the full request sent in each case?

“curl -v” to show what it sends. Or “tcpdump” on the nginx server to  
see what it receives.

> However, the curl request returns the expected result (204) from my  
> servlet. The program keeps getting this 302 returned with some generic  
> “302 Found” html from nginx.

If you see different headers sent from your code and curl, perhaps try  
adding or removing one at a time to see if there is one that matters.

> My eyes are blurry from staring at it. Can anyone tell me why my test  
> with curl works, but the program sending the same request does not???

Purely on the lines you have shown: does your code or config do anything  
based on $http\_user\_agent or the equivalent?

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![AJ\_Weber](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8c91f0/32.png) [@AJ\_Weber](https://www.ruby-forum.com/u/AJ_Weber)\
**Post date:** [October 26, 2012, 10:37am UTC](https://www.ruby-forum.com/t/why-two-different-responses/223997/3 "2012-10-26T10:37:40Z")

</div>

On Oct 26, 2012, at 7:03 , AJ Weber wrote:

> One of these requests is sent by my program. One is sent by curl (it’s easy to  
> tell which). They are identical as far as I can tell. However, the curl request  
> returns the expected result (204) from my servlet. The program keeps getting this  
> 302 returned with some generic “302 Found” html from nginx.
> 
> My eyes are blurry from staring at it. Can anyone tell me why my test with curl  
> works, but the program sending the same request does not???
> 
> Thanks,  
> AJ
> 
> xx.yy.zz.64 - - [26/Oct/2012:02:49:38 +0000] “GET  
> /myCoordinator/Coordinator?Action=servers HTTP/1.1” upstream\_cache\_status - 302  
> 171 “-” “-” “-”
> 
> tt.ss.kk.134 - - [26/Oct/2012:02:52:43 +0000] “GET  
> /myCoordinator/Coordinator?Action=servers HTTP/1.1” upstream\_cache\_status MISS 204  
> 0 “-” “curl/7.19.7 (x86\_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.1.0  
> zlib/1.2.3 libidn/1.18 libssh2/1.2.2” “-”

Most probably your program does not pass “Host” header.
