Skip to content

Commit 5bbec81

Browse files
authored
Merge pull request #3181 from nextcloud/enh/2933/fix-trusted-proxies
fix notify-push trusted proxies
2 parents f1a71ac + b8f5342 commit 5bbec81

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Containers/apache/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ RUN set -ex; \
3030
tzdata \
3131
ca-certificates \
3232
openssl \
33+
bind-tools \
3334
netcat-openbsd; \
3435
\
3536
sed -i \

Containers/apache/start.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ while ! nc -z "$NEXTCLOUD_HOST" 9000; do
1717
sleep 5
1818
done
1919

20+
# Get ipv4-address of Apache
21+
IPv4_ADDRESS="$(dig nextcloud-aio-apache A +short | head -1)"
22+
# Bring it in CIDR notation
23+
# shellcheck disable=SC2001
24+
IPv4_ADDRESS="$(echo "$IPv4_ADDRESS" | sed 's|[0-9]\+$|1/32|')"
25+
2026
if [ -z "$APACHE_PORT" ]; then
2127
export APACHE_PORT="443"
2228
fi
@@ -41,7 +47,7 @@ echo "$CADDYFILE" > /tmp/Caddyfile
4147
if [ "$APACHE_PORT" != '443' ]; then
4248
CADDYFILE="$(sed 's|# trusted_proxies placeholder|trusted_proxies static private_ranges|' /tmp/Caddyfile)"
4349
else
44-
CADDYFILE="$(sed 's|trusted_proxies.*private_ranges|# trusted_proxies placeholder|' /tmp/Caddyfile)"
50+
CADDYFILE="$(sed "s|# trusted_proxies placeholder|trusted_proxies static $IPv4_ADDRESS|" /tmp/Caddyfile)"
4551
fi
4652
echo "$CADDYFILE" > /tmp/Caddyfile
4753

0 commit comments

Comments
 (0)