400 bad request

Dave Cheney dave at cheney.net
Sat Jun 13 06:22:03 MSD 2009

So, here is what I get on my nginx when I submit a bad request

[root at odessa ~]# nginx -v
nginx version: nginx/0.7.31

moriarty:~ dave$ telnet odessa.cheney.net 80
Connected to odessa.cheney.net.
Escape character is '^]'.
GET $ HTTP/1.1
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
Connection closed by foreign host.

==> /var/log/nginx/access.log <== odessa.cheney.net - [12/Jun/2009:22:18:41 -0400] "-"  
400 166 "-" "-"

If you are receiving *nothing* in your logs then my next suggestion is  
to get out ngrep and sniff the wire traffic

[root at odessa ~]# ngrep -d eth0 port 80
interface: eth0 (
T -> [AP]
   GET $ HTTP/1.1..
T -> [AP]
   <html>..<head><title>400 Bad Request</title></head>..<body  
bgcolor="white">..<center><h1>400 Bad Request</h1></cente
T -> [A]

If you can post the results of your ngrep, I might be able to suggest  



On 13/06/2009, at 11:44 AM, snacktime wrote:

> Dave Cheney Wrote:
> -------------------------------------------------------
>> So, to confirm, there is no record of the request
>> at all in your
>> access log?
> Nothing.  I set the log level on the error log to debug also to see  
> if that would force something into the error logs, but nothing.
> But facebook is telling you that it
>> could not contact your
>> servers (sorry, I have no experience with writing
>> facebook apps) ?
> I'll try to explain as best I can.  The request that generates the  
> errors is not going through facebook, that's how we know it's nginx  
> because the page displays the raw nginx error page with the nginx  
> version number and all.  That page is inside an iframe on a facebook  
> canvas page.  The iframe loads pages directly from our server.   
> Inside the iframe is also some fb javascript code that loads a proxy  
> file from our server directly to handle cross domain iframe  
> communications, and at the same time sets cookies on our domain.  We  
> think it's the facebook javascript code we are running in our iframe  
> that is setting the cookies that nginx doesn't like.  We are pretty  
> sure about this because some of the banner ads we run on other pages  
> of our site are also facebook connect iframes, and they also have  
> the same effect.  Once they set a bad cookie, all the images on the  
> facebook canvas which reference our servers start to break due to  
> 400 responses.
> Chris
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,2757,2880#msg-2880

More information about the nginx mailing list