Welcome! Log In Create A New Profile

Advanced

Re: server_name that starts with a number

Maxim Dounin
September 26, 2017 10:16AM
Hello!

On Tue, Sep 26, 2017 at 02:42:41PM +0200, rainer@ultra-secure.de wrote:

> I have a website that has a server_name that starts with a number (or
> two numbers, actually).
>
> I also have a catchall default_server configured with the server_name
> "_".
>
> Now, it seems when the server_name starts with a number, it's ignored
> and requests are routed to the default server.

Just a quick test, with the only the following server{} blocks in
the http{} section:

server {
listen 8080;
server_name _;
return 200 $server_name\n;
}

server {
listen 8080;
server_name 12test.example.com;
return 200 $server_name\n;
}

Testing it with curl:

$ curl -H 'Host: foo.example.com' http://127.0.0.1:8080/
_
$ curl -H 'Host: 12test.example.com' http://127.0.0.1:8080/
12test.example.com

So clearly it selects correct server based on the name provided in
the request, even when there are names starting with a number.

> Can someone explain this?
>
> How do I fix this?

Most likely explanations are, in no particular order:

- you've configured it wrong;
- you are testing it wrong.

To find out what exactly happened and how to fix this, please
provide the following:

- full yet minimal configuration you are able to reproduce the
behaviour in question (providing "nginx -T" output might be a
good idea);

- steps you use to test things.

Note well that testing with browsers is generally a bad idea, as
browsers tend to cache responses.

--
Maxim Dounin
http://nginx.org/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

server_name that starts with a number

Anonymous User September 26, 2017 08:44AM

Re: server_name that starts with a number

Maxim Dounin September 26, 2017 10:16AM

Re: server_name that starts with a number

Anonymous User September 26, 2017 10:48AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 224
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready