Minor "bug" in nginx

Igor Sysoev is at rambler-co.ru
Thu Apr 30 08:50:49 MSD 2009


On Wed, Apr 29, 2009 at 05:23:13PM -0700, Michael Shadle wrote:

> isn't this the same then?
> 
> server {
>  listen 80;
> server_name _;
> }
> 
> server {
> listen 80 default;
> }
> 
> if you only had one of those in your config, the fallbacks would occur
> to those blocks, if they did not match any others though, right?
> 
> obviously mixing them would prefer the listen 80 default; i assume?

No, these are different things. The default server for *:80 is only

 server {
  listen 80 default;
 }

or the first server listing on *:80 if you have no "default" keyword.

The "server_name _" is just invalid and so nonexistent domain name
that will never interfere with any real name.

> 2009/4/29 Maxim Dounin <mdounin at mdounin.ru>:
> > Hello!
> >
> > On Wed, Apr 29, 2009 at 03:57:28PM -0700, Michael Shadle wrote:
> >
> >> On Wed, Apr 29, 2009 at 3:01 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> >>
> >> > It MUST per RFC2616.  There is no difference between
> >> >
> >> > GET http://example.com/ HTTP/1.1
> >> > Host: ignored
> >> >
> >> > and
> >> >
> >> > GET / HTTP/1.1
> >> > Host: example.com
> >> >
> >> > See RFC2616 for details (5.2 The Resource Identified by a Request).
> >>
> >> Okay, I see - so it is serving up HTTP 200 because I have a "catchall"
> >> server_name _ somewhere.
> >
> > No.  There is nothing special in server_name _.  It's just name.
> > Default server for every listen socket is *always* present - it's
> > either one with listen .. default or first server defined with
> > listen socket in question.
> >
> > Maxim Dounin
> >
> >

-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list