Francis Daly
March 08, 2012 01:42PM
On Thu, Mar 08, 2012 at 12:55:15PM -0500, Kaimei wrote:

Hi there,

> Is this is bug or how to get the real hostname the user connect to ?

The nginx variable $server_name is the first name in the server_name
directive list.

The nginx variable $http_host is the Host: header sent by the client.

The nginx variable $host is $http_host if it is defined, and $server_name
if not.

The typical nginx fastcgi configuration will set SERVER_NAME to
$server_name (within fastcgi.conf) and HTTP_HOST to http_host (because
that's what happens to client headers). So you can check those in
your script.

If you wish, you can add your own "fastcgi_param HOST $host" setting
and check that, or you could set SERVER_NAME to be $host and continue
checking that one.

f
--
Francis Daly francis@daoine.org

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

Possible bug in value of $server_name variable

Kaimei March 08, 2012 12:55PM

Re: Possible bug in value of $server_name variable

Francis Daly March 08, 2012 01:42PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 315
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