mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-19 22:16:49 +00:00
fix trusted_proxies for caddy in case of a reverse proxy situation
Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
parent
145d83c000
commit
f0ddf95a3e
3 changed files with 36 additions and 8 deletions
|
|
@ -21,17 +21,30 @@ if [ -z "$APACHE_PORT" ]; then
|
|||
export APACHE_PORT="443"
|
||||
fi
|
||||
|
||||
# Change the Caddyfile
|
||||
# Change variables in case of reverse proxies
|
||||
if [ "$APACHE_PORT" != '443' ]; then
|
||||
export PROTOCOL="http"
|
||||
export NC_DOMAIN=""
|
||||
CADDYFILE="$(sed 's|auto_https.*|auto_https off|' /Caddyfile)"
|
||||
else
|
||||
export PROTOCOL="https"
|
||||
fi
|
||||
|
||||
# Change the auto_https in case of reverse proxies
|
||||
if [ "$APACHE_PORT" != '443' ]; then
|
||||
CADDYFILE="$(sed 's|auto_https.*|auto_https off|' /Caddyfile)"
|
||||
else
|
||||
CADDYFILE="$(sed 's|auto_https.*|auto_https disable_redirects|' /Caddyfile)"
|
||||
fi
|
||||
echo "$CADDYFILE" > /Caddyfile
|
||||
|
||||
# Change the trusted_proxies in case of reverse proxies
|
||||
if [ "$APACHE_PORT" != '443' ]; then
|
||||
CADDYFILE="$(sed 's|# trusted_proxies placeholder|trusted_proxies private_ranges|' /Caddyfile)"
|
||||
else
|
||||
CADDYFILE="$(sed 's|trusted_proxies private_ranges|# trusted_proxies placeholder|' /Caddyfile)"
|
||||
fi
|
||||
echo "$CADDYFILE" > /Caddyfile
|
||||
|
||||
# Add caddy path
|
||||
mkdir -p /mnt/data/caddy/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue