Skip to content

Commit a49ca22

Browse files
authored
Fix redirectrule for everyone (#2655)
Signed-off-by: Daniel Hansson <[email protected]>
1 parent 99ab136 commit a49ca22

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

nextcloud_update.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ fi
345345
# Upgrade OS dependencies
346346
export DEBIAN_FRONTEND=noninteractive ; apt-get dist-upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
347347

348-
# Temporary fix for PHP 2024-08-27
348+
# Temporary fix for PHP 2023-08-27
349349
# There's a bug in PHP 8.1.21 which causes server to crash
350350
# If you're on Ondrejs PPA, PHP isn't updated, so do that here instead
351351
apt-mark unhold php* >/dev/null 2>&1
@@ -779,6 +779,23 @@ else
779779
print_text_in_color "$IGreen" "Your apps are already up to date!"
780780
fi
781781

782+
# Apply correct redirect rule to avoid security check errors
783+
REDIRECTRULE="$(grep -r "\[R=301,L\]" $SITES_AVAILABLE | cut -d ":" -f1)"
784+
if [ -n "$REDIRECTRULE" ]
785+
then
786+
# Change the redirect rule in all files in Apache available
787+
mapfile -t REDIRECTRULE <<< "$REDIRECTRULE"
788+
for rule in "${REDIRECTRULE[@]}"
789+
do
790+
sed -i "s|\[R=301,L\]|\[END,NE,R=permanent\]|g" "$rule"
791+
done
792+
# Restart Apache
793+
if check_command apachectl configtest
794+
then
795+
restart_webserver
796+
fi
797+
fi
798+
782799
# Nextcloud 13 is required.
783800
lowest_compatible_nc 13
784801

0 commit comments

Comments
 (0)