Opened 10 years ago

Closed 10 years ago

#571 closed defect (worksforme)

Nginx treats dashes in server_name as catch-all servers

Reported by: Jad Joubran Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.4.x
Keywords: server_name Cc:
uname -a: Linux production-etobb 3.14.4-x86-linode59 #1 SMP Tue May 13 12:23:36 EDT 2014 i686 i686 i386 GNU/Linux
nginx -V: nginx version: nginx/1.4.1

Description

The following nginx configuration

server {
    listen 80;
    server_name aaa.example.com;
    root /var/www/aaa;
}

server {

    listen 80;
    server_name hello-world.example.com;
    root /var/www/hello;
}

because the server_name of the second server contains a dash (-), nginx will always open the second server (whether you go to hello-world.example.com or aaa.example.com)

I fixed it by renaming hello-world to helloworld (removing the dash fixed the issue).

Change History (3)

comment:1 by Sergey Kandaurov, 10 years ago

Could you provide a debug log?

comment:2 by Jad Joubran, 10 years ago

I'm afraid I can't because the issue happened on a production machine and I had to fix it as soon as possible..
The bug should be triggered with the provided configuration

comment:3 by Sergey Kandaurov, 10 years ago

Resolution: worksforme
Status: newclosed

Could not reproduce it on 1.4.1 with the provided configuration snippet.
You'd need at least submit the entire config and the relevant error log messages.

Note: See TracTickets for help on using tickets.