aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/HttpUtils.php
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2017-01-04 16:34:06 +0100
committerGitHub <noreply@github.com>2017-01-04 16:34:06 +0100
commit061f04fba06d2a78246de747e2bdd5625fc22400 (patch)
tree486bbf6956d44dc93010c3ff38a36691e7218802 /application/HttpUtils.php
parent2d3a9be73de8a2e7b38ba0c8af19b940bf376243 (diff)
parent8e4be773685f7dff074f23e2df13072577091f44 (diff)
downloadShaarli-061f04fba06d2a78246de747e2bdd5625fc22400.tar.gz
Shaarli-061f04fba06d2a78246de747e2bdd5625fc22400.tar.zst
Shaarli-061f04fba06d2a78246de747e2bdd5625fc22400.zip
Merge pull request #733 from ArthurHoaro/hotfix/reverse-proxy-port
Hide default ports in local URL behind a reverse proxy
Diffstat (limited to 'application/HttpUtils.php')
-rw-r--r--application/HttpUtils.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/application/HttpUtils.php b/application/HttpUtils.php
index e705cfd6..e8fc1f5d 100644
--- a/application/HttpUtils.php
+++ b/application/HttpUtils.php
@@ -297,9 +297,17 @@ function server_url($server)
297 // Keep forwarded port 297 // Keep forwarded port
298 if (strpos($server['HTTP_X_FORWARDED_PORT'], ',') !== false) { 298 if (strpos($server['HTTP_X_FORWARDED_PORT'], ',') !== false) {
299 $ports = explode(',', $server['HTTP_X_FORWARDED_PORT']); 299 $ports = explode(',', $server['HTTP_X_FORWARDED_PORT']);
300 $port = ':' . trim($ports[0]); 300 $port = trim($ports[0]);
301 } else { 301 } else {
302 $port = ':' . $server['HTTP_X_FORWARDED_PORT']; 302 $port = $server['HTTP_X_FORWARDED_PORT'];
303 }
304
305 if (($scheme == 'http' && $port != '80')
306 || ($scheme == 'https' && $port != '443')
307 ) {
308 $port = ':' . $port;
309 } else {
310 $port = '';
303 } 311 }
304 } 312 }
305 313