All request is redirected to one port if there is multiple listen in default server section

I use the following config:

server {
listen 192.168.1.102:80;
listen 192.168.1.102:81;

    server_name  _;  #default
    return 444;
}

#upstream cfg
upstream web_upstream0 {
server 192.168.39.100:81 max_fails=3 fail_timeout=30s;

}
    upstream web_upstream1 {
    server 192.168.39.100 max_fails=3  fail_timeout=30s;

}

server {
listen 192.168.1.102:81;
server_name www.test1.com;
location / {

        proxy_pass http://web_upstream0/;
}

}
server {
listen 192.168.1.102:80;
server_name www.test2.com;
location / {

        proxy_pass http://web_upstream1/;
}

}

It seems all request to www.test1.com is passed to www.test2.com.

If I use:

server {
listen 192.168.1.102:80;

    server_name  _;  #default
    return 444;
}

server {
listen 192.168.1.102:81;

    server_name  _;  #default
    return 444;
}

instead, every thing is OK.
Is this a bug ?

On Fri, Apr 10, 2009 at 10:24:59AM +0800, Delta Y. wrote:

#upstream cfg
listen 192.168.1.102:81;

server {
}

instead, every thing is OK.
Is this a bug ?

Yes, this is a bug, introduced in 0.7.39. The attached patch fixes it.

thanks for you quick fix.

2009/4/10 Igor S. [email protected]