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

**URL:** <https://www.ruby-forum.com/t/intermittent-400-error-code-client-sent-invalid-method-while-reading-client-request-line/220982>\
**Category:** NGINX\
**Created:** [June 27, 2012, 5:38am UTC](https://www.ruby-forum.com/t/intermittent-400-error-code-client-sent-invalid-method-while-reading-client-request-line/220982 "2012-06-27T05:38:36Z")\
**Posts on this page:** 2\
**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 27, 2012, 5:38am UTC](https://www.ruby-forum.com/t/intermittent-400-error-code-client-sent-invalid-method-while-reading-client-request-line/220982/1 "2012-06-27T05:38:36Z")

</div>

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](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:

> **[Intermittent 400 error code -client sent invalid method while reading client...](https://forum.nginx.org/read.php?2,227966,227966#msg-227966)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![paphillon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/67e7ee/32.png) [@paphillon](https://www.ruby-forum.com/u/paphillon)\
**Post date:** [June 27, 2012, 9:50am UTC](https://www.ruby-forum.com/t/intermittent-400-error-code-client-sent-invalid-method-while-reading-client-request-line/220982/2 "2012-06-27T09:50:28Z")

</div>

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](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.
