Skip to content

Commit 0d79b89

Browse files
吴盼yunwuxin
吴盼
authored andcommitted
think/Request host方法获取域名改进
1 parent 9788154 commit 0d79b89

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/think/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,7 @@ public function setHost($host)
18001800
public function host($strict = false)
18011801
{
18021802
if (!$this->host) {
1803-
$this->host = $this->server('HTTP_X_REAL_HOST') ?: $this->server('HTTP_HOST');
1803+
$this->host = $this->server('HTTP_X_REAL_HOST') ?: $this->server('HTTP_X_FORWARDED_HOST') ?: $this->server('HTTP_HOST');
18041804
}
18051805

18061806
return true === $strict && strpos($this->host, ':') ? strstr($this->host, ':', true) : $this->host;

0 commit comments

Comments
 (0)