# Debug Http 400 Errors

**URL:** <https://www.ruby-forum.com/t/debug-http-400-errors/140066>\
**Category:** NGINX\
**Created:** [June 10, 2008, 3:32pm UTC](https://www.ruby-forum.com/t/debug-http-400-errors/140066 "2008-06-10T15:32:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Davy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bb73d2/32.png) [@Davy\_C](https://www.ruby-forum.com/u/Davy_C)\
**Post date:** [June 10, 2008, 3:32pm UTC](https://www.ruby-forum.com/t/debug-http-400-errors/140066/1 "2008-06-10T15:32:30Z")

</div>

I’m getting some 400 errors in my logs, and I’m wondering if there is a  
log  
variable which will tell me the attempted url that was trying to be  
accessed. I have tried both $request and $request\_uri, but both look  
like  
they give the path to the file trying to be accessed, and are blank when  
the  
error code is 400.

Here is my logging definition:

log\_format response\_times '$request\_time $remote\_addr [$time\_local]  
$request\_uri $status ';

Couple samples:

0.000 64.231.103.198 [10/Jun/2008:08:24:36 -0500] /static/file.swf 304  
13.775 99.229.230.29 [10/Jun/2008:08:24:37 -0500] /static/file.swf 200  
0.000 194.144.8.59 [10/Jun/2008:08:24:38 -0500] - 400

---

<div class="post-metadata">

**Author:** ![Davy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bb73d2/32.png) [@Davy\_C](https://www.ruby-forum.com/u/Davy_C)\
**Post date:** [June 10, 2008, 5:43pm UTC](https://www.ruby-forum.com/t/debug-http-400-errors/140066/2 "2008-06-10T17:43:31Z")

</div>

I’ve debugged this a little further and found the following info  
messages  
from the clients getting a 400:

2008/06/10 10:31:32 [info] 8788#0: \*29524 client closed prematurely  
connection while reading client request line, client: 77.40.197.215,  
server:  
\_  
2008/06/10 10:31:33 [info] 8788#0: \*29776 recv() failed (104: Connection  
reset by peer) while reading client request line, client: 60.51.123.123,  
server: \_  
2008/06/10 10:31:33 [info] 8788#0: \*29556 client closed prematurely  
connection while reading client request line, client: 77.40.197.215,  
server:  
\_

Anyone?

---

<div class="post-metadata">

**Author:** ![Davy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bb73d2/32.png) [@Davy\_C](https://www.ruby-forum.com/u/Davy_C)\
**Post date:** [June 11, 2008, 7:03am UTC](https://www.ruby-forum.com/t/debug-http-400-errors/140066/3 "2008-06-11T07:03:20Z")

</div>

On Tue, 10 Jun 2008 09:25:07 -0400  
“Davy C.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m getting some 400 errors in my logs, and I’m wondering if there is  
> a log variable which will tell me the attempted url that was trying  
> to be accessed. I have tried both $request and $request\_uri, but  
> both look like they give the path to the file trying to be accessed,  
> and are blank when the error code is 400.  
> […]  
> 0.000 194.144.8.59 [10/Jun/2008:08:24:38 -0500] - 400

This is what you see when the client closed the connection before their  
request was actually sent. So you can’t get the attempted url in the  
log; the server never received a url from the client.
