Getting 400 Bad Request when requesting by server name on nginx/uwsgi

Posted by Marc Hughes on Server Fault See other posts from Server Fault or by Marc Hughes
Published on 2014-08-24T21:12:49Z Indexed on 2014/08/24 22:22 UTC
Read the original article Hit count: 585

Filed under:
|

I'm trying to run 2 different sites on nginx via different ports (they each have a load balancer that points to the appropriate port).

The first site work perfectly.

The second site...

  • If I access http://localhost:81/ it works correctly
  • If I access http://127.0.01:81/ it works correctly
  • If I access the hostname http://THEHOSTNAME:81/ it fails with a 400 error
  • If I access the public IP http://x.x.x.x:81/ it fails with a 400 error

I've set the error_log to info, but the only lines I get in the log when this happens is:

==> /var/log/nginx/access.log <==
10.183.38.141 - - [24/Aug/2014:21:03:28 +0000] "GET / HTTP/1.1" 400 37 "-" "curl/7.36.0" "-"

==> /var/log/nginx/error.log <==
2014/08/24 21:03:28 [info] 7029#0: *5 client 10.183.38.141 closed keepalive connection

In my uwsgi log, I only see this:

[pid: 6870|app: 0|req: 87/92] 10.28.23.224 () {32 vars in 380 bytes} [Sun Aug 24 21:05:21 2014] GET / => generated 26 bytes in 1 msecs (HTTP/1.1 400) 2 headers in 82 bytes (1 switches on core 2)

What should be my next step in debugging this?

© Server Fault or respective owner

Related posts about nginx

Related posts about uwsgi