Intermittent 400 error code -client sent invalid method while reading client request line,

In our setup we have a client that makes some web services calls to the
back end with nginx as a proxy in between.

Most of the time it is successful 99% but 1% calls are dropped and the
client reports the error. On retry the operation goes through fine, no
other change is requried.

The client is on a hosted environment, so getting detailed logs from
client is bit hard.

(Client Error) — Error: unable to send request to :
https://proxt.nginx.host.url. Server response:
System.HttpResponse[Status=null, StatusCode=-1]

Nginx captures the below in the default server error log. Interestingly
no access / error log is written for the virtual host that is suppose to
handle the request.

2012/06/26 20:22:55 [debug] 32536#0: *305 http check ssl handshake
2012/06/26 20:22:55 [debug] 32536#0: *305 https ssl handshake: 0x16
2012/06/26 20:22:55 [debug] 32536#0: *305 http process request line
2012/06/26 20:22:55 [debug] 32536#0: *305 http process request line
2012/06/26 20:22:55 [info] 32536#0: *305 client sent invalid method
while reading client request line, client: 96.43.x.x, server: , request:
“User-Agent: Java/1.6.0_21”
2012/06/26 20:22:55 [debug] 32536#0: *305 http finalize request: 400,
“?” a:1, c:1
2012/06/26 20:22:55 [debug] 32536#0: *305 http special response: 400,
“?”
2012/06/26 20:22:55 [debug] 32536#0: *305 http set discard body
2012/06/26 20:22:55 [debug] 32536#0: *305 headers more header filter,
uri “”
2012/06/26 20:22:55 [debug] 32536#0: *305 http output filter “?”
2012/06/26 20:22:55 [debug] 32536#0: *305 http copy filter: “?”
2012/06/26 20:22:55 [debug] 32536#0: *305 http postpone filter “?”
000000001C39D958
2012/06/26 20:22:55 [debug] 32536#0: *305 http write filter: l:1 f:0
s:166
2012/06/26 20:22:55 [debug] 32536#0: *305 http write filter limit 0
2012/06/26 20:22:55 [debug] 32536#0: *305 http write filter
0000000000000000
2012/06/26 20:22:55 [debug] 32536#0: *305 http copy filter: 0 “?”
2012/06/26 20:22:55 [debug] 32536#0: *305 http finalize request: 0, “?”
a:1, c:1
2012/06/26 20:22:55 [debug] 32536#0: *305 http lingering close handler
2012/06/26 20:22:55 [debug] 32536#0: *305 lingering read: 0
2012/06/26 20:22:55 [debug] 32536#0: *305 http request count:1 blk:0
2012/06/26 20:22:55 [debug] 32536#0: *305 http close request
2012/06/26 20:22:55 [debug] 32536#0: *305 http log handler
2012/06/26 20:22:55 [debug] 32536#0: *305 close http connection: 10

Any pointers?

Posted at Nginx Forum:

Hello!

On Tue, Jun 26, 2012 at 11:38:11PM -0400, paphillon wrote:

(Client Error) — Error: unable to send request to :
https://proxt.nginx.host.url. Server response:
System.HttpResponse[Status=null, StatusCode=-1]

Nginx captures the below in the default server error log. Interestingly
no access / error log is written for the virtual host that is suppose to
handle the request.

As request is invalid and there is no Host header, it’s not
possible to match virtual host. So no surpirse here.

2012/06/26 20:22:55 [debug] 32536#0: *305 http check ssl handshake
2012/06/26 20:22:55 [debug] 32536#0: *305 https ssl handshake: 0x16
2012/06/26 20:22:55 [debug] 32536#0: *305 http process request line
2012/06/26 20:22:55 [debug] 32536#0: *305 http process request line
2012/06/26 20:22:55 [info] 32536#0: *305 client sent invalid method
while reading client request line, client: 96.43.x.x, server: , request:
“User-Agent: Java/1.6.0_21”

It looks like client indeed failed to produce correct request,
“User-Agent: Java/1.6.0_21” doesn’t looks like valid one.

[…]

Maxim D.