PHP SERVER_NAME
not passed correctly for multiple canonical domains
#1550
Labels
SERVER_NAME
not passed correctly for multiple canonical domains
#1550
Version
1.22.1
What did you expect to happen?
PHP
$_SERVER['SERVER_NAME']
is assigned the correct domain that is requested,not the first (or random?) one in
server_name
innginx
site configuration.This prevents redirection from redirection plugins.
What actually happens?
PHP
$_SERVER['SERVER_NAME']
is assigned incorrect domain, as the first (or random?) one inserver_name
innginx
site configuration.Steps to reproduce
print_r($_SERVER);
inindex.php
).Note that the
SERVER_NAME
field in$_SERVER
is not correct for all other requested canonical domains except for one (usually the first listed one).Note that the
SERVER_NAME
is not always the first canonical domain, apparently this can change, which caused issues with a redirection plugin that redirected from the wrong canonical domain.System info
Ubuntu LTS
Log output
No response
Please confirm this isn't a support request.
Yes
Context
In order to fix the passed
SERVER_NAME
,$host
instead of$server_name
has to be used:In
fastcgi_params
configuration file included by the sites,$server_name
is used:And
$server_name
is the wrong value:(from Michael Hampton in https://serverfault.com/a/706439/958731).
As
fastctgi_params
is a default configuration file shipped withnginx
, it makes sense tooverride the
SERVER_NAME
field after that file was included, in order to override it effectively:The text was updated successfully, but these errors were encountered: