aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-07-13 14:15:06 +0200
committerGitHub <noreply@github.com>2017-07-13 14:15:06 +0200
commit2fee2f425d244e50ff64416f302a941a4470d8d2 (patch)
treef21fed77b74ee708026491dfcec44350f59cec9c /application
parent70cb883547a04b3ccd3fda567d15541d124a3f41 (diff)
parent0b51ea72517efa8731348cfaed410c71cb2bfd91 (diff)
downloadShaarli-2fee2f425d244e50ff64416f302a941a4470d8d2.tar.gz
Shaarli-2fee2f425d244e50ff64416f302a941a4470d8d2.tar.zst
Shaarli-2fee2f425d244e50ff64416f302a941a4470d8d2.zip
Merge pull request #899 from smuth4/master
Respect HTTP_X_FORWARDED_HOST
Diffstat (limited to 'application')
-rw-r--r--application/HttpUtils.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/application/HttpUtils.php b/application/HttpUtils.php
index a81f9056..88a1efdb 100644
--- a/application/HttpUtils.php
+++ b/application/HttpUtils.php
@@ -311,7 +311,19 @@ function server_url($server)
311 } 311 }
312 } 312 }
313 313
314 return $scheme.'://'.$server['SERVER_NAME'].$port; 314 if (isset($server['HTTP_X_FORWARDED_HOST'])) {
315 // Keep forwarded host
316 if (strpos($server['HTTP_X_FORWARDED_HOST'], ',') !== false) {
317 $hosts = explode(',', $server['HTTP_X_FORWARDED_HOST']);
318 $host = trim($hosts[0]);
319 } else {
320 $host = $server['HTTP_X_FORWARDED_HOST'];
321 }
322 } else {
323 $host = $server['SERVER_NAME'];
324 }
325
326 return $scheme.'://'.$host.$port;
315 } 327 }
316 328
317 // SSL detection 329 // SSL detection