From 204f89ca218f03e06b121e460855f05592c3af9f Mon Sep 17 00:00:00 2001 From: nitrag Date: Sat, 27 Jan 2024 13:35:10 -0500 Subject: [PATCH 1/2] Fix proxy urls --- website/inc/locked.inc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/website/inc/locked.inc b/website/inc/locked.inc index 8499b0fb..ecc79563 100644 --- a/website/inc/locked.inc +++ b/website/inc/locked.inc @@ -35,6 +35,11 @@ function preferred_urls($use_https = false) { $addrs = gethostbynamel(gethostname()); $urls = array(); + // accomodate hosted on proxy servers (eg. nginx) + if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { + $addrs = array($_SERVER['HTTP_HOST']); + } + // IIS apparently doesn't set REQUEST_URI. if (isset($_SERVER['REQUEST_URI'])) { $uri = dirname($_SERVER['REQUEST_URI']); From 578bdc495fdfea359e65797c5e08497a68d9461f Mon Sep 17 00:00:00 2001 From: nitrag Date: Wed, 31 Jan 2024 10:55:18 -0500 Subject: [PATCH 2/2] Update locked.inc --- website/inc/locked.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/inc/locked.inc b/website/inc/locked.inc index ecc79563..736a4ed4 100644 --- a/website/inc/locked.inc +++ b/website/inc/locked.inc @@ -35,8 +35,8 @@ function preferred_urls($use_https = false) { $addrs = gethostbynamel(gethostname()); $urls = array(); - // accomodate hosted on proxy servers (eg. nginx) - if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { + // accommodate hosted on proxy servers (eg. nginx) + if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $addrs = array($_SERVER['HTTP_HOST']); }