From e2891016aba12ae3afefa475a7c470c8f323c51a Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Thu, 28 Dec 2023 15:16:29 +0200 Subject: [PATCH] Fix to correctly handle redirects with break https://github.com/virtualmin/virtualmin-gpl/issues/712 --- virtual_feature.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/virtual_feature.pl b/virtual_feature.pl index 679f2e1..a910fd9 100644 --- a/virtual_feature.pl +++ b/virtual_feature.pl @@ -1771,7 +1771,8 @@ sub feature_list_web_redirects } my $m = $r->{'words'}->[2]; $redirect->{'code'} = $m eq 'permanent' ? 301 : - $m eq 'redirect' ? 302 : undef; + $m eq 'redirect' ? 302 : + $m eq 'break' ? 302 : undef; } elsif ($r->{'words'}->[0] =~ /\^\/\(\?\!\.well\-known\)(\$)?/) { # Special case for / which excludes .well-known @@ -1793,8 +1794,9 @@ sub feature_list_web_redirects $redirect->{'dest'}, 0); $redirect->{'alias'} = 0; } - elsif ($r->{'words'}->[2] eq 'redirect' || - $r->{'words'}->[2] eq 'permanent') { + elsif ($r->{'words'}->[2] eq 'permanent' || + $r->{'words'}->[2] eq 'redirect' || + $r->{'words'}->[2] eq 'break') { # Redirect to a URL path, which is taken as relative # to the original URL $redirect->{'alias'} = 0;