Skip to content

Commit

Permalink
Merge pull request #65 from virtualmin/dev/fix-redirects-with-break
Browse files Browse the repository at this point in the history
Fix to correctly handle redirects with break
  • Loading branch information
jcameron authored Dec 28, 2023
2 parents c49273a + e289101 commit 92b13c5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions virtual_feature.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit 92b13c5

Please sign in to comment.