I have my site which is using nginx, and testing site with header testing tools e.g. http://www.webconfs.com/http-header-check.php but every time it says 400 bad request below is the out put from the tool. Though all my pages load perfectly fine in browser and when I see in chrome console it says status code 200OK.
HTTP/1.1 400 Bad Request =>
Server => nginx
Date => Fri, 07 Sep 2012 09:40:09 GMT
Content-Type => text/html
Content-Length => 166
Connection => close
I really don't understand what is the problem with my server config?
A bit of googling suggests to increase the buffer size using, and I increased it to following:
large_client_header_buffers 4 16k;
The same results persist.
Can some one guide me to the right direction?
Just to clearify, in /etc/nginx/nginx.conf, you can put at the beginning of the file the line
And then restart nginx:
That way you can detail what nginx is doing and why it is returning the status code 400.
A cause can be invalid encoding in the URL request. Such as % being passed un-encoded.
As stated by Maxim Dounin in the comments above:
Yes changing the error_to debug level as Emmanuel Joubaud suggested worked out (edit /etc/nginx/sites-enabled/default ):
Then after restaring nginx I got in the error log with my Python application using uwsgi:
Then I took a look to my uwsgi log and found out that:
And adding www.mysite.local to the settings.py ALLOWED_CONFIGS fixed the issue :)
normally, Maxim Donnie's method can find the reason. But I encountered one 400 bad request will not log to err_log. I found the reason with the help with tcpdump