Empty server name argument - Can't get it to work

Luigi Perroti luigi.perroti at googlemail.com
Thu Aug 28 12:36:19 MSD 2008


Hi,

I'm trying out the new 0.7.13 release which permits to use "" as server name,
but there must be something wrong with my configuration since I can't get this
new feature to work.

Here's the relevant snippet from my configuration file:

http {
  access_log off;
  recursive_error_pages off;
  server {
    listen 123.123.123.123:80;
    server_name _ "";
    error_page 400 /400.html;
    location /400.html {
      internal;
      if ($host = "") {
        access_log /var/log/access.log;
      }
    }
    location / {
      fastcgi_pass   127.0.0.1:1234;
      fastcgi_intercept_errors on;
    }
  }	
}

I thought that with this configuration I'd be able to:
- have the application behind the fastcgi server receive requests with no Host:
header specified.
- log into access.log when my custom 400 error page is served, but only if no
Host: header is present.

Instead the behaviour I'm observing is that when nginx receives a request
without the Host: header my custom 400 page gets served without sending the
request to the fastcgi server and nothing is logged into access.log either.

Any suggestion would be most welcome, thank you.

Regards,
-Luigi






More information about the nginx mailing list