aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcamael24 <thehawk@hoa-project.net>2015-03-20 15:01:51 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2015-08-03 09:30:41 +0200
commit9f4fb3669a3802f0993b8a2fe9943de842a62fe0 (patch)
treee5abe1d58909dd6d98e251220858eef3938ec605
parent01c337932120f75877696246d18c24527f197ad2 (diff)
downloadRouter-9f4fb3669a3802f0993b8a2fe9943de842a62fe0.zip
Router-9f4fb3669a3802f0993b8a2fe9943de842a62fe0.tar.gz
Router-9f4fb3669a3802f0993b8a2fe9943de842a62fe0.tar.bz2
`getDomain` uses HTTP_HOST instead of SERVER_NAME.
The `SERVER_NAME` variable does not contain the subdomain all the time, and more importantly, it does not really contain the domain at all. For instance: # $_SERVER['SERVER_NAME'] === "sub.foo.app" server_name sub.foo.app other.foo.app; # $_SERVER['SERVER_NAME'] === "foo.app" server_name foo.app bar.foo.app; # $_SERVER['SERVER_NAME'] === "*.foo.app" server_name *.foo.app foo.app; So we fallback to `HTTP_HOST` as before.
-rw-r--r--Http/Http.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/Http/Http.php b/Http/Http.php
index 903289f..ce95d8f 100644
--- a/Http/Http.php
+++ b/Http/Http.php
@@ -780,7 +780,7 @@ class Http extends Router\Generic implements Core\Parameter\Parameterizable
return $domain = '';
}
- $domain = $_SERVER['SERVER_NAME'];
+ $domain = $_SERVER['HTTP_HOST'];
if (empty($domain)) {
$domain = $_SERVER['SERVER_ADDR'];