From ead647fd60150efea13b745cb30a6d80dc394d31 Mon Sep 17 00:00:00 2001 From: Ninos Date: Tue, 17 Aug 2021 22:43:33 +0200 Subject: [PATCH] Enhancement: Allow hostnames in trusted proxies --- .config/reverse-proxy.config.php | 2 +- 20/apache/config/reverse-proxy.config.php | 2 +- 20/fpm-alpine/config/reverse-proxy.config.php | 2 +- 20/fpm/config/reverse-proxy.config.php | 2 +- 21/apache/config/reverse-proxy.config.php | 2 +- 21/fpm-alpine/config/reverse-proxy.config.php | 2 +- 21/fpm/config/reverse-proxy.config.php | 2 +- 22/apache/config/reverse-proxy.config.php | 2 +- 22/fpm-alpine/config/reverse-proxy.config.php | 2 +- 22/fpm/config/reverse-proxy.config.php | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.config/reverse-proxy.config.php b/.config/reverse-proxy.config.php index 667be312..ef00e07f 100644 --- a/.config/reverse-proxy.config.php +++ b/.config/reverse-proxy.config.php @@ -21,5 +21,5 @@ if ($overwriteCondAddr) { $trustedProxies = getenv('TRUSTED_PROXIES'); if ($trustedProxies) { - $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies))); + $CONFIG['trusted_proxies'] = array_values(array_unique(array_map('gethostbyname', array_filter(explode(' ', $trustedProxies))))); } diff --git a/20/apache/config/reverse-proxy.config.php b/20/apache/config/reverse-proxy.config.php index 667be312..ef00e07f 100644 --- a/20/apache/config/reverse-proxy.config.php +++ b/20/apache/config/reverse-proxy.config.php @@ -21,5 +21,5 @@ if ($overwriteCondAddr) { $trustedProxies = getenv('TRUSTED_PROXIES'); if ($trustedProxies) { - $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies))); + $CONFIG['trusted_proxies'] = array_values(array_unique(array_map('gethostbyname', array_filter(explode(' ', $trustedProxies))))); } diff --git a/20/fpm-alpine/config/reverse-proxy.config.php b/20/fpm-alpine/config/reverse-proxy.config.php index 667be312..ef00e07f 100644 --- a/20/fpm-alpine/config/reverse-proxy.config.php +++ b/20/fpm-alpine/config/reverse-proxy.config.php @@ -21,5 +21,5 @@ if ($overwriteCondAddr) { $trustedProxies = getenv('TRUSTED_PROXIES'); if ($trustedProxies) { - $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies))); + $CONFIG['trusted_proxies'] = array_values(array_unique(array_map('gethostbyname', array_filter(explode(' ', $trustedProxies))))); } diff --git a/20/fpm/config/reverse-proxy.config.php b/20/fpm/config/reverse-proxy.config.php index 667be312..ef00e07f 100644 --- a/20/fpm/config/reverse-proxy.config.php +++ b/20/fpm/config/reverse-proxy.config.php @@ -21,5 +21,5 @@ if ($overwriteCondAddr) { $trustedProxies = getenv('TRUSTED_PROXIES'); if ($trustedProxies) { - $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies))); + $CONFIG['trusted_proxies'] = array_values(array_unique(array_map('gethostbyname', array_filter(explode(' ', $trustedProxies))))); } diff --git a/21/apache/config/reverse-proxy.config.php b/21/apache/config/reverse-proxy.config.php index 667be312..ef00e07f 100644 --- a/21/apache/config/reverse-proxy.config.php +++ b/21/apache/config/reverse-proxy.config.php @@ -21,5 +21,5 @@ if ($overwriteCondAddr) { $trustedProxies = getenv('TRUSTED_PROXIES'); if ($trustedProxies) { - $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies))); + $CONFIG['trusted_proxies'] = array_values(array_unique(array_map('gethostbyname', array_filter(explode(' ', $trustedProxies))))); } diff --git a/21/fpm-alpine/config/reverse-proxy.config.php b/21/fpm-alpine/config/reverse-proxy.config.php index 667be312..ef00e07f 100644 --- a/21/fpm-alpine/config/reverse-proxy.config.php +++ b/21/fpm-alpine/config/reverse-proxy.config.php @@ -21,5 +21,5 @@ if ($overwriteCondAddr) { $trustedProxies = getenv('TRUSTED_PROXIES'); if ($trustedProxies) { - $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies))); + $CONFIG['trusted_proxies'] = array_values(array_unique(array_map('gethostbyname', array_filter(explode(' ', $trustedProxies))))); } diff --git a/21/fpm/config/reverse-proxy.config.php b/21/fpm/config/reverse-proxy.config.php index 667be312..ef00e07f 100644 --- a/21/fpm/config/reverse-proxy.config.php +++ b/21/fpm/config/reverse-proxy.config.php @@ -21,5 +21,5 @@ if ($overwriteCondAddr) { $trustedProxies = getenv('TRUSTED_PROXIES'); if ($trustedProxies) { - $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies))); + $CONFIG['trusted_proxies'] = array_values(array_unique(array_map('gethostbyname', array_filter(explode(' ', $trustedProxies))))); } diff --git a/22/apache/config/reverse-proxy.config.php b/22/apache/config/reverse-proxy.config.php index 667be312..ef00e07f 100644 --- a/22/apache/config/reverse-proxy.config.php +++ b/22/apache/config/reverse-proxy.config.php @@ -21,5 +21,5 @@ if ($overwriteCondAddr) { $trustedProxies = getenv('TRUSTED_PROXIES'); if ($trustedProxies) { - $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies))); + $CONFIG['trusted_proxies'] = array_values(array_unique(array_map('gethostbyname', array_filter(explode(' ', $trustedProxies))))); } diff --git a/22/fpm-alpine/config/reverse-proxy.config.php b/22/fpm-alpine/config/reverse-proxy.config.php index 667be312..ef00e07f 100644 --- a/22/fpm-alpine/config/reverse-proxy.config.php +++ b/22/fpm-alpine/config/reverse-proxy.config.php @@ -21,5 +21,5 @@ if ($overwriteCondAddr) { $trustedProxies = getenv('TRUSTED_PROXIES'); if ($trustedProxies) { - $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies))); + $CONFIG['trusted_proxies'] = array_values(array_unique(array_map('gethostbyname', array_filter(explode(' ', $trustedProxies))))); } diff --git a/22/fpm/config/reverse-proxy.config.php b/22/fpm/config/reverse-proxy.config.php index 667be312..ef00e07f 100644 --- a/22/fpm/config/reverse-proxy.config.php +++ b/22/fpm/config/reverse-proxy.config.php @@ -21,5 +21,5 @@ if ($overwriteCondAddr) { $trustedProxies = getenv('TRUSTED_PROXIES'); if ($trustedProxies) { - $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies))); + $CONFIG['trusted_proxies'] = array_values(array_unique(array_map('gethostbyname', array_filter(explode(' ', $trustedProxies))))); }