aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/Request.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Minz/Request.php')
-rw-r--r--lib/Minz/Request.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php
index 24e30546f..8b2b610d6 100644
--- a/lib/Minz/Request.php
+++ b/lib/Minz/Request.php
@@ -118,7 +118,9 @@ class Minz_Request {
$https = self::isHttps();
- if (!empty($_SERVER['HTTP_HOST'])) {
+ if (!empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
+ $host = parse_url('http://' . $_SERVER['HTTP_X_FORWARDED_HOST'], PHP_URL_HOST);
+ } elseif (!empty($_SERVER['HTTP_HOST'])) {
//Might contain a port number, and mind IPv6 addresses
$host = parse_url('http://' . $_SERVER['HTTP_HOST'], PHP_URL_HOST);
} elseif (!empty($_SERVER['SERVER_NAME'])) {
@@ -142,6 +144,9 @@ class Minz_Request {
} else {
$url .= '://' . $host . ($port == 80 ? '' : ':' . $port);
}
+ if (!empty($_SERVER['HTTP_X_FORWARDED_PREFIX'])) {
+ $url .= rtrim($_SERVER['HTTP_X_FORWARDED_PREFIX'], '/ ');
+ }
if (isset($_SERVER['REQUEST_URI'])) {
$path = $_SERVER['REQUEST_URI'];
$url .= substr($path, -1) === '/' ? substr($path, 0, -1) : dirname($path);